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

Mariya Podchishchaeva via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 23 01:05:56 PDT 2023


Fznamznon added inline comments.


================
Comment at: clang/include/clang/AST/Decl.h:3186
+
+  void printName(raw_ostream &OS, const PrintingPolicy &Policy) const override;
 };
----------------
shafik wrote:
> So it looks like w/o this we would end up using `NamedDecl::printName(...)` is that right?
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
 
----------------
shafik wrote:
> I am curious what the rest of the diagnostic message from `anonymous union at...` says.
It points to the source location of anonymous member definition, I'm seeing "/absolute/path/to/file/ast-dump-APValue-anon-union.cpp::20:3"


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