aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
authorSteve Merritt <steve.merritt@intel.com>2022-08-08 10:40:11 -0400
committerSteve Merritt <steve.merritt@intel.com>2022-08-16 10:33:43 -0400
commitec60fca7527582cbd949aaeaf923fb710d7c3244 (patch)
tree5c23d364dbc62ab0eac9cd6e181ad4d855a36acb /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
parent65c7cecb13f8d2132a54103903501474083afe8f (diff)
downloadllvm-ec60fca7527582cbd949aaeaf923fb710d7c3244.zip
llvm-ec60fca7527582cbd949aaeaf923fb710d7c3244.tar.gz
llvm-ec60fca7527582cbd949aaeaf923fb710d7c3244.tar.bz2
[CodeView] Use non-qualified names for static local variables
Static variables declared within a routine or lexical block should be emitted with a non-qualified name. This allows the variables to be visible to the Visual Studio watch window. Differential Revision: https://reviews.llvm.org/D131400
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index f34e922..16213af 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -3350,11 +3350,13 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
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 *>()) {