[PATCH] D131400: [CodeView] Use non-qualified names for static local variables

Steve Merritt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 9 09:23:22 PDT 2022


smerritt updated this revision to Diff 451184.
smerritt added a comment.

Update comment per review  and restart builds.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131400/new/

https://reviews.llvm.org/D131400

Files:
  llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
  llvm/test/DebugInfo/COFF/global_visibility.ll


Index: llvm/test/DebugInfo/COFF/global_visibility.ll
===================================================================
--- llvm/test/DebugInfo/COFF/global_visibility.ll
+++ llvm/test/DebugInfo/COFF/global_visibility.ll
@@ -53,12 +53,12 @@
 ; CHECK:     }
 ; CHECK:     DataSym {
 ; CHECK:       Kind: S_LDATA32 (0x110C)
-; CHECK:       DisplayName: foo::local_int
+; CHECK:       DisplayName: local_int
 ; CHECK:       LinkageName: ?local_int@?1??foo@@YAXXZ at 4HA
 ; CHECK:     }
 ; CHECK:     DataSym {
 ; CHECK:       Kind: S_LDATA32 (0x110C)
-; CHECK:       DisplayName: foo::nested_int
+; CHECK:       DisplayName: nested_int
 ; CHECK:       LinkageName: ?nested_int@?1??foo@@YAXXZ at 4HA
 ; CHECK:     }
 ; CHECK:     ProcEnd {
@@ -74,12 +74,12 @@
 ; CHECK:     }
 ; CHECK:     DataSym {
 ; CHECK:       Kind: S_LDATA32 (0x110C)
-; CHECK:       DisplayName: bar::local_int
+; CHECK:       DisplayName: local_int
 ; CHECK:       LinkageName: ?local_int@?1??bar@@YAXXZ at 4HA
 ; CHECK:     }
 ; CHECK:     DataSym {
 ; CHECK:       Kind: S_LDATA32 (0x110C)
-; CHECK:       DisplayName: bar::nested_int
+; CHECK:       DisplayName: nested_int
 ; CHECK:       LinkageName: ?nested_int@?1??bar@@YAXXZ at 4HA
 ; CHECK:     }
 ; CHECK:     ProcEnd {
Index: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -3350,11 +3350,13 @@
   if (const auto *MemberDecl = dyn_cast_or_null<DIDerivedType>(
           DIGV->getRawStaticDataMemberDeclaration()))
     Scope = MemberDecl->getScope();
-  // For Fortran, the scoping portion is elided in its name so that we can
-  // reference the variable in the command line of the VS debugger.
+  // For static local variables and Fortran, the scoping portion is elided
+  // in its name so that we can reference the variable in the command line
+  // of the VS debugger.
   std::string QualifiedName =
-      (moduleIsInFortran()) ? std::string(DIGV->getName())
-                            : getFullyQualifiedName(Scope, DIGV->getName());
+      (moduleIsInFortran() || isa<DILocalScope>(Scope))
+          ? std::string(DIGV->getName())
+          : getFullyQualifiedName(Scope, DIGV->getName());
 
   if (const GlobalVariable *GV =
           CVGV.GVInfo.dyn_cast<const GlobalVariable *>()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131400.451184.patch
Type: text/x-patch
Size: 2389 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220809/173a2760/attachment.bin>


More information about the llvm-commits mailing list