summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp6
-rw-r--r--llvm/test/DebugInfo/COFF/cpp-mangling.ll55
2 files changed, 36 insertions, 25 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp b/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
index 7a5c4f3136a..f3b871704d6 100644
--- a/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
@@ -210,12 +210,10 @@ void WinCodeViewLineTables::emitDebugInfoForFunction(const Function *GV) {
if (auto *SP = getDISubprogram(GV))
FuncName = SP->getDisplayName();
- // FIXME Clang currently sets DisplayName to "bar" for a C++
- // "namespace_foo::bar" function, see PR21528. Luckily, dbghelp.dll is trying
- // to demangle display names anyways, so let's just put a mangled name into
- // the symbols subsection until Clang gives us what we need.
+ // If our DISubprogram name is empty, use the mangled name.
if (FuncName.empty())
FuncName = GlobalValue::getRealLinkageName(GV->getName());
+
// Emit a symbol subsection, required by VS2012+ to find function boundaries.
MCSymbol *SymbolsBegin = Asm->MMI->getContext().createTempSymbol(),
*SymbolsEnd = Asm->MMI->getContext().createTempSymbol();
diff --git a/llvm/test/DebugInfo/COFF/cpp-mangling.ll b/llvm/test/DebugInfo/COFF/cpp-mangling.ll
index 36b9fb1ee80..c528349c956 100644
--- a/llvm/test/DebugInfo/COFF/cpp-mangling.ll
+++ b/llvm/test/DebugInfo/COFF/cpp-mangling.ll
@@ -1,4 +1,6 @@
-; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 -o - -O0 < %s | llvm-mc -triple=i686-pc-win32 -filetype=obj | llvm-readobj -s -sr -codeview -section-symbols | FileCheck %s
+; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 -o - -O0 < %s \
+; RUN: | llvm-mc -triple=i686-pc-win32 -filetype=obj \
+; RUN: | llvm-readobj -s -sr -codeview -section-symbols | FileCheck %s
; This LL file was generated by running clang on the following code:
; D:\src.cpp:
@@ -9,35 +11,46 @@
; 5 }
; CHECK: ProcStart {
-; FIXME: The display name should in fact be "foo::bar", see PR21528
-; CHECK: DisplayName: ?bar@foo@@YAHH@Z
+; CHECK: DisplayName: foo::bar
; CHECK-NEXT: LinkageName: ?bar@foo@@YAHH@Z
-; Function Attrs: nounwind
-define i32 @"\01?bar@foo@@YAHH@Z"(i32 %x) #0 {
+; Function Attrs: nounwind uwtable
+define i32 @"\01?bar@foo@@YAHH@Z"(i32 %x) #0 !dbg !4 {
entry:
%x.addr = alloca i32, align 4
store i32 %x, i32* %x.addr, align 4
- %0 = load i32, i32* %x.addr, align 4, !dbg !11
- %mul = mul nsw i32 %0, 2, !dbg !11
- ret i32 %mul, !dbg !11
+ call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !13, metadata !14), !dbg !15
+ %0 = load i32, i32* %x.addr, align 4, !dbg !16
+ %mul = mul nsw i32 %0, 2, !dbg !17
+ ret i32 %mul, !dbg !18
}
-attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
+; Function Attrs: nounwind readnone
+declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
+
+attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
+attributes #1 = { nounwind readnone }
!llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!8, !9}
-!llvm.ident = !{!10}
+!llvm.module.flags = !{!9, !10, !11}
+!llvm.ident = !{!12}
-!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.6.0 ", isOptimized: false, emissionKind: 2, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
-!1 = !DIFile(filename: "<stdin>", directory: "D:\5C")
+!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 257652)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, subprograms: !3)
+!1 = !DIFile(filename: "t2.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
!2 = !{}
!3 = !{!4}
-!4 = distinct !DISubprogram(name: "bar", line: 2, isLocal: false, isDefinition: true, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !5, scope: !6, type: !7, variables: !2)
-!5 = !DIFile(filename: "src.cpp", directory: "D:\5C")
-!6 = !DIFile(filename: "src.cpp", directory: "D:C")
-!7 = !DISubroutineType(types: !2)
-!8 = !{i32 2, !"CodeView", i32 1}
-!9 = !{i32 2, !"Debug Info Version", i32 3}
-!10 = !{!"clang version 3.6.0 "}
-!11 = !DILocation(line: 3, scope: !4)
+!4 = distinct !DISubprogram(name: "foo::bar", linkageName: "\01?bar@foo@@YAHH@Z", scope: !5, file: !1, line: 2, type: !6, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, variables: !2)
+!5 = !DINamespace(name: "foo", scope: null, file: !1, line: 1)
+!6 = !DISubroutineType(types: !7)
+!7 = !{!8, !8}
+!8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
+!9 = !{i32 2, !"CodeView", i32 1}
+!10 = !{i32 2, !"Debug Info Version", i32 3}
+!11 = !{i32 1, !"PIC Level", i32 2}
+!12 = !{!"clang version 3.9.0 (trunk 257652)"}
+!13 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !1, line: 2, type: !8)
+!14 = !DIExpression()
+!15 = !DILocation(line: 2, column: 13, scope: !4)
+!16 = !DILocation(line: 3, column: 10, scope: !4)
+!17 = !DILocation(line: 3, column: 12, scope: !4)
+!18 = !DILocation(line: 3, column: 3, scope: !4)
OpenPOWER on IntegriCloud