[llvm] r257723 - [codeview] Regenerate C++ display name test case and update comments

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 16:12:55 PST 2016


Author: rnk
Date: Wed Jan 13 18:12:54 2016
New Revision: 257723

URL: http://llvm.org/viewvc/llvm-project?rev=257723&view=rev
Log:
[codeview] Regenerate C++ display name test case and update comments

Clang generates good display names for codeview since r255744, and the
change to make LLVM use them was accidentally included in r257658.

This change just updates the comments and test case to reflect reality
better.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
    llvm/trunk/test/DebugInfo/COFF/cpp-mangling.ll

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp?rev=257723&r1=257722&r2=257723&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp Wed Jan 13 18:12:54 2016
@@ -210,12 +210,10 @@ void WinCodeViewLineTables::emitDebugInf
   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();

Modified: llvm/trunk/test/DebugInfo/COFF/cpp-mangling.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/COFF/cpp-mangling.ll?rev=257723&r1=257722&r2=257723&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/COFF/cpp-mangling.ll (original)
+++ llvm/trunk/test/DebugInfo/COFF/cpp-mangling.ll Wed Jan 13 18:12:54 2016
@@ -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 at foo@@YAHH at Z
+; CHECK:     DisplayName: foo::bar
 ; CHECK-NEXT:     LinkageName: ?bar at foo@@YAHH at Z
 
-; Function Attrs: nounwind
-define i32 @"\01?bar at foo@@YAHH at Z"(i32 %x) #0 {
+; Function Attrs: nounwind uwtable
+define i32 @"\01?bar at foo@@YAHH at 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 at foo@@YAHH at 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)




More information about the llvm-commits mailing list