dblaikie added a comment.

Looks like this only implements support for typedefs, but the flag in GCC does 
more than that (as the flag name indicates - it's about unused types in 
general) - could you test this across some non-trivial code and see if it 
matches GCC's behavior (or, where it doesn't, that there's a good reason for 
that divergence)

Here's a few cases I tested by hand:

  typedef int t1; // yes
  struct t2 { }; // yes
  template<typename T>
  struct t3 { T t; };
  void f1(
      decltype(t3<int>::t), // yes (t3<int>)
  t3<float>); // no (t3<float>)
  struct t4; // no
  struct t5; // yes because \/
  typedef t5* t6; // yes
  struct t7; // no
  void f2(t7*);

https://godbolt.org/z/SgHxJv



================
Comment at: clang/lib/CodeGen/CodeGenModule.cpp:5559
+  case Decl::Typedef:
+    if (getCodeGenOpts().DebugUnusedTypes)
+      if (CGDebugInfo *DI = getModuleDebugInfo())
----------------
Probably test this within the implementation of CGDebugInfo? & rename the 
EmitTypedef function to something that clarifies that it's for an otherwise 
unused type?

But that function might need to be generalized further, rather than only having 
it for typedefs. (see general comment above)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80242



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to