[PATCH] D158526: [clang] Properly print unnamed members in diagnostics

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 22 10:20:47 PDT 2023


shafik added a comment.

Thank you for this fix, it is a lot cleaner than I was expecting.



================
Comment at: clang/include/clang/AST/Decl.h:3186
+
+  void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override;
 };
----------------
So it looks like w/o this we would end up using `NamedDecl::printName(...)` is that right?


================
Comment at: clang/test/AST/ast-dump-APValue-anon-union.cpp:43
   // CHECK:  | `-VarDecl {{.*}} <col:{{.*}}, col:{{.*}}> col:{{.*}} u0b 'const U0':'const U0' constexpr listinit
-  // CHECK-NEXT:  |   |-value: Union . Union .f Float 3.141500e+00
+  // CHECK-NEXT:  |   |-value: Union .U0::(anonymous union at {{.*}}) Union .f Float 3.141500e+00
 
----------------
I am curious what the rest of the diagnostic message from `anonymous union at...` says.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D158526



More information about the cfe-commits mailing list