[PATCH] D67141: [DebugInfo] Emit DW_TAG_enumeration_type for referenced global enumerator.

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 4 11:28:00 PDT 2019


rnk added inline comments.


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:4441-4462
+  // Use global variables for enums in CodeView, use DW_TAG_enumeration_type for
+  // enums for non-CodeView.
   if (const auto *ECD = dyn_cast<EnumConstantDecl>(VD)) {
     const auto *ED = cast<EnumDecl>(ECD->getDeclContext());
     assert(isa<EnumType>(ED->getTypeForDecl()) && "Enum without EnumType?");
-    (void)ED;
+
+    // If not CodeView, emit DW_TAG_enumeration_type if necessary.
----------------
Please simplify the logic and make these comments more coherent and understandable. This return is redundant with the later return, for example.

Basically, rC361400 removed an otherwise unused call to getOrCreateType. getOrCreateType happens to have the side effect of recording all enum types on the side in DIBuilder::AllEnumTypes, which are eventually referred to by the compile unit.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67141/new/

https://reviews.llvm.org/D67141





More information about the cfe-commits mailing list