From 8374bf43634725dc02a262a77b5f940fca25938c Mon Sep 17 00:00:00 2001 From: Alexandre Ganea Date: Thu, 18 Jun 2020 10:02:02 -0400 Subject: [CodeView] Fix generated command-line expansion in LF_BUILDINFO. Fix the 'pdb' entry which was previously a null reference, now an empty string. Previously, the DIA SDK didn't like the empty reference in the 'pdb' entry. --- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp') diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 7f47849..cf3c38c 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -849,10 +849,11 @@ static std::string flattenCommandLine(ArrayRef Args, continue; } if (!LastArg.empty()) - FlatCmdLine += " "; + OS << " "; llvm::sys::printArg(OS, Arg, /*Quote=*/true); LastArg = Arg; } + OS.flush(); return FlatCmdLine; } @@ -876,6 +877,9 @@ void CodeViewDebug::emitBuildInfo() { getStringIdTypeIdx(TypeTable, MainSourceFile->getDirectory()); BuildInfoArgs[BuildInfoRecord::SourceFile] = getStringIdTypeIdx(TypeTable, MainSourceFile->getFilename()); + // FIXME: PDB is intentionally blank unless we implement /Zi type servers. + BuildInfoArgs[BuildInfoRecord::TypeServerPDB] = + getStringIdTypeIdx(TypeTable, ""); if (Asm->TM.Options.MCOptions.Argv0 != nullptr) { BuildInfoArgs[BuildInfoRecord::BuildTool] = getStringIdTypeIdx(TypeTable, Asm->TM.Options.MCOptions.Argv0); @@ -883,7 +887,6 @@ void CodeViewDebug::emitBuildInfo() { TypeTable, flattenCommandLine(Asm->TM.Options.MCOptions.CommandLineArgs, MainSourceFile->getFilename())); } - // FIXME: PDB is intentionally blank unless we implement /Zi type servers. BuildInfoRecord BIR(BuildInfoArgs); TypeIndex BuildInfoIndex = TypeTable.writeLeafType(BIR); -- cgit v1.1