From: Amy Huang Date: Thu, 13 Jun 2019 22:53:43 +0000 (+0000) Subject: Use fully qualified name when printing S_CONSTANT records X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f46e18fb70234e4f7d162184cd12377360b508e8;p=clang 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@363335 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 549056dad4..af9bac9b38 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/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(VD)) { const auto *ED = cast(ECD->getDeclContext()); assert(isa(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(ED->getDeclContext())) return; }