r361400 - Combine two if cases because the second one is never reached.

Amy Huang via cfe-commits cfe-commits at lists.llvm.org
Wed May 22 08:49:00 PDT 2019


Author: akhuang
Date: Wed May 22 08:48:59 2019
New Revision: 361400

URL: http://llvm.org/viewvc/llvm-project?rev=361400&view=rev
Log:
Combine two if cases because the second one is never reached.

Subscribers: cfe-commits

Tags: #clang

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

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=361400&r1=361399&r2=361400&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed May 22 08:48:59 2019
@@ -4352,16 +4352,14 @@ void CGDebugInfo::EmitGlobalVariable(con
   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;




More information about the cfe-commits mailing list