Combine two if cases because the second one is never reached.
authorAmy Huang <akhuang@google.com>
Wed, 22 May 2019 15:48:59 +0000 (15:48 +0000)
committerAmy Huang <akhuang@google.com>
Wed, 22 May 2019 15:48:59 +0000 (15:48 +0000)
Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D62214

llvm-svn: 361400

clang/lib/CodeGen/CGDebugInfo.cpp

index f436cab16c4e93d3a102b73741bd4f4513c38fa8..fec092ad22149162c65a95d65042cf298aec69a2 100644 (file)
@@ -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<EnumConstantDecl>(VD)) {
     const auto *ED = cast<EnumDecl>(ECD->getDeclContext());
     assert(isa<EnumType>(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<FunctionDecl>(VD->getDeclContext()))
     return;