forked from OSchip/llvm-project
[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.
This commit is contained in:
parent
0c66af970c
commit
8374bf4363
|
@ -1,6 +1,6 @@
|
|||
// RUN: %clang_cl /c /Z7 /Fo%t.obj -- %s
|
||||
// RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s
|
||||
// RUN: %clang_cl /c /Z7 %s /Fo%t.obj -fdebug-compilation-dir .
|
||||
// RUN: %clang_cl /c /Z7 /Fo%t.obj -fdebug-compilation-dir . -- %s
|
||||
// RUN: llvm-pdbutil dump --types %t.obj | FileCheck %s --check-prefix RELATIVE
|
||||
|
||||
int main() { return 42; }
|
||||
|
@ -9,13 +9,14 @@ int main() { return 42; }
|
|||
// CHECK: ============================================================
|
||||
// CHECK: 0x[[PWD:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: [[PWDVAL:.+]]
|
||||
// CHECK: 0x[[FILEPATH:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: [[FILEPATHVAL:.+[\\/]debug-info-codeview-buildinfo.c]]
|
||||
// CHECK: 0x[[ZIPDB:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String:
|
||||
// CHECK: 0x[[TOOL:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: [[TOOLVAL:.+[\\/]clang.*]]
|
||||
// CHECK: 0x[[CMDLINE:.+]] | LF_STRING_ID [size = {{.+}}] ID: <no type>, String: "-cc1
|
||||
// CHECK: 0x{{.+}} | LF_BUILDINFO [size = {{.+}}]
|
||||
// CHECK: 0x[[PWD]]: `[[PWDVAL]]`
|
||||
// CHECK: 0x[[TOOL]]: `[[TOOLVAL]]`
|
||||
// CHECK: 0x[[FILEPATH]]: `[[FILEPATHVAL]]`
|
||||
// CHECK: <no type>: ``
|
||||
// CHECK: 0x[[ZIPDB]]: ``
|
||||
// CHECK: 0x[[CMDLINE]]: `"-cc1
|
||||
|
||||
// RELATIVE: Types (.debug$T)
|
||||
|
|
|
@ -849,10 +849,11 @@ static std::string flattenCommandLine(ArrayRef<const char *> 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);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
; CHECK-NEXT: 0x{{.*}}: `D:\src\scopes\clang`
|
||||
; CHECK-NEXT: <no type>: ``
|
||||
; CHECK-NEXT: 0x{{.*}}: `D:\src\scopes\foo.cpp`
|
||||
; CHECK-NEXT: <no type>: ``
|
||||
; CHECK-NEXT: 0x{{.*}}: ``
|
||||
; CHECK-NEXT: <no type>: ``
|
||||
|
||||
; CHECK: {{.*}} | S_BUILDINFO [size = 8] BuildId = `[[INFO_IDX]]`
|
||||
|
|
|
@ -295,7 +295,8 @@ attributes #2 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-ma
|
|||
; YAML: - 4470750F2E319329
|
||||
; YAML: - 0FB556FD1FAB66D7
|
||||
; YAML: - 5970EFB4874D0F3F
|
||||
; YAML: - EDB1D74C120CF44A
|
||||
; YAML: - D8EF11198C33843F
|
||||
; YAML: - D81F744D7366282B
|
||||
; ...
|
||||
|
||||
|
||||
|
|
|
@ -511,14 +511,22 @@
|
|||
; ASM: .asciz "t.cpp" # StringData
|
||||
; ASM: .byte 242
|
||||
; ASM: .byte 241
|
||||
; ASM: # BuildInfo (0x1015)
|
||||
; ASM: # StringId (0x1015)
|
||||
; ASM: .short 0xa # Record length
|
||||
; ASM: .short 0x1605 # Record kind: LF_STRING_ID
|
||||
; ASM: .long 0x0 # Id
|
||||
; ASM: .byte 0 # StringData
|
||||
; ASM: .byte 243
|
||||
; ASM: .byte 242
|
||||
; ASM: .byte 241
|
||||
; ASM: # BuildInfo (0x1016)
|
||||
; ASM: .short 0x1a # Record length
|
||||
; ASM: .short 0x1603 # Record kind: LF_BUILDINFO
|
||||
; ASM: .short 0x5 # NumArgs
|
||||
; ASM: .long 0x1013 # Argument: D:\src\llvm\build
|
||||
; ASM: .long 0x0 # Argument
|
||||
; ASM: .long 0x1014 # Argument: t.cpp
|
||||
; ASM: .long 0x0 # Argument
|
||||
; ASM: .long 0x1015 # Argument
|
||||
; ASM: .long 0x0 # Argument
|
||||
; ASM: .byte 242
|
||||
; ASM: .byte 241
|
||||
|
|
|
@ -727,14 +727,22 @@
|
|||
; ASM: .asciz "t.cpp" # StringData
|
||||
; ASM: .byte 242
|
||||
; ASM: .byte 241
|
||||
; ASM: # BuildInfo (0x1022)
|
||||
; ASM: # StringId (0x1022)
|
||||
; ASM: .short 0xa # Record length
|
||||
; ASM: .short 0x1605 # Record kind: LF_STRING_ID
|
||||
; ASM: .long 0x0 # Id
|
||||
; ASM: .byte 0 # StringData
|
||||
; ASM: .byte 243
|
||||
; ASM: .byte 242
|
||||
; ASM: .byte 241
|
||||
; ASM: # BuildInfo (0x1023)
|
||||
; ASM: .short 0x1a # Record length
|
||||
; ASM: .short 0x1603 # Record kind: LF_BUILDINFO
|
||||
; ASM: .short 0x5 # NumArgs
|
||||
; ASM: .long 0x1020 # Argument: D:\src\llvm\build
|
||||
; ASM: .long 0x0 # Argument
|
||||
; ASM: .long 0x1021 # Argument: t.cpp
|
||||
; ASM: .long 0x0 # Argument
|
||||
; ASM: .long 0x1022 # Argument
|
||||
; ASM: .long 0x0 # Argument
|
||||
; ASM: .byte 242
|
||||
; ASM: .byte 241
|
||||
|
|
Loading…
Reference in New Issue