[PATCH] D80242: [Clang] implement -fno-eliminate-unused-debug-types

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 31 13:42:55 PDT 2020


nickdesaulniers marked an inline comment as not done.
nickdesaulniers added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:3842-3846
+  if (EmitDwarf &&
+      Args.hasFlag(options::OPT_fno_eliminate_unused_debug_types,
+                   options::OPT_feliminate_unused_debug_types, false) &&
+      DebugInfoKind >= codegenoptions::DebugInfoConstructor)
+    DebugInfoKind = codegenoptions::UnusedTypeInfo;
----------------
dblaikie wrote:
> Would this be tidier if it were rolled into the if/checking around 380 since it's a very similar option?
Sorry, I recently rebased, is 380 still where you were thinking...or...? (Maybe you can add some code context in case it moves again)?  Maybe 490 (`DebugLevelToInfoKind`)?  Otherwise I don't really see other patterns that check `EmitDwarf`.


================
Comment at: clang/test/CodeGen/debug-info-unused-types.cpp:24-30
+// NODBG-NOT: !DICompositeType(tag: DW_TAG_enumeration_type, name: "baz"
+// NODBG-NOT: !DIEnumerator(name: "BAZ"
+// NODBG-NOT: !DICompositeType(tag: DW_TAG_enumeration_type, name: "z"
+// NODBG-NOT: !DIEnumerator(name: "Z"
+// NODBG-NOT: !DIDerivedType(tag: DW_TAG_typedef, name: "foo"
+// NODBG-NOT: !DICompositeType(tag: DW_TAG_class_type, name: "bar"
+// NODBG-NOT: !DICompositeType(tag: DW_TAG_class_type, name: "y"
----------------
dblaikie wrote:
> Maybe simpler to test the NODBG by `NODBG-NOT: DI{{[a-zA-Z]*}}Type` ? Not sure if that'd quite work, but might be adequate.
`DISubroutineType` unfortunately would match. `!DI{{CompositeType|Enumerator|DerivedType}} ` does work though!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80242



More information about the cfe-commits mailing list