From f2e7f1730f424ec41ba5a68ea09ced96219f9065 Mon Sep 17 00:00:00 2001 From: Amy Huang Date: Wed, 22 May 2019 15:48:59 +0000 Subject: [PATCH] Combine two if cases because the second one is never reached. Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62214 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@361400 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index f436cab16c..fec092ad22 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -4352,16 +4352,14 @@ void CGDebugInfo::EmitGlobalVariable(const ValueDecl *VD, const APValue &Init) { llvm::DIFile *Unit = getOrCreateFile(VD->getLocation()); StringRef Name = VD->getName(); llvm::DIType *Ty = getOrCreateType(VD->getType(), Unit); + + // Do not use global variables for enums. if (const auto *ECD = dyn_cast(VD)) { const auto *ED = cast(ECD->getDeclContext()); assert(isa(ED->getTypeForDecl()) && "Enum without EnumType?"); - Ty = getOrCreateType(QualType(ED->getTypeForDecl(), 0), Unit); - } - // Do not use global variables for enums. - // - // FIXME: why not? - if (Ty->getTag() == llvm::dwarf::DW_TAG_enumeration_type) return; + } + // Do not emit separate definitions for function local const/statics. if (isa(VD->getDeclContext())) return; -- 2.50.1