summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorAmy Huang <akhuang@google.com>2019-06-13 22:53:43 +0000
committerAmy Huang <akhuang@google.com>2019-06-13 22:53:43 +0000
commit49275272e3ec77e443418dda49b7b9cf0285c189 (patch)
tree2936fae3c919bafac71ca6013be3ea8314967f6f /clang/lib/CodeGen/CGDebugInfo.cpp
parent0feb6e52f18e68f74746cdcd2c52400bf49d54ed (diff)
downloadbcm5719-llvm-49275272e3ec77e443418dda49b7b9cf0285c189.tar.gz
bcm5719-llvm-49275272e3ec77e443418dda49b7b9cf0285c189.zip
Use fully qualified name when printing S_CONSTANT records
Summary: Before it was using the fully qualified name only for static data members. Now it does for all variable names to match MSVC. Reviewers: rnk Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D63012 llvm-svn: 363335
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 549056dad42..af9bac9b388 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -4361,13 +4361,18 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, const APValue &Init) {
StringRef Name = VD->getName();
llvm::DIType *Ty = getOrCreateType(VD->getType(), Unit);
- // Do not use global variables for enums, unless for CodeView.
+ // Do not use global variables for enums, unless in CodeView.
if (const auto *ECD = dyn_cast<EnumConstantDecl>(VD)) {
const auto *ED = cast<EnumDecl>(ECD->getDeclContext());
assert(isa<EnumType>(ED->getTypeForDecl()) && "Enum without EnumType?");
(void)ED;
- if (!CGM.getCodeGenOpts().EmitCodeView)
+ // If CodeView, emit enums as global variables, unless they are defined
+ // inside a class. We do this because MSVC doesn't emit S_CONSTANTs for
+ // enums in classes, and because it is difficult to attach this scope
+ // information to the global variable.
+ if (!CGM.getCodeGenOpts().EmitCodeView ||
+ isa<RecordDecl>(ED->getDeclContext()))
return;
}
OpenPOWER on IntegriCloud