[PATCH] D42736: [DebugInfo] Improvements to representation of enumeration types (PR36168)

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 31 11:07:22 PST 2018


dblaikie added inline comments.


================
Comment at: lib/CodeGen/CGDebugInfo.cpp:2490-2491
   for (const auto *Enum : ED->enumerators()) {
-    Enumerators.push_back(DBuilder.createEnumerator(
-        Enum->getName(), Enum->getInitVal().getSExtValue()));
+    const auto &InitVal = Enum->getInitVal();
+    bool IsSigned = ED->getIntegerType()->isSignedIntegerType();
+    auto Value = IsSigned ? InitVal.getSExtValue() : InitVal.getZExtValue();
----------------
Move this "IsSigned" outside the loop, since it's loop invariant?



Repository:
  rC Clang

https://reviews.llvm.org/D42736





More information about the cfe-commits mailing list