aaron.ballman added a comment.

Thank you for working on this! Please be sure to add a release note and test 
coverage for the changes.



================
Comment at: clang/lib/AST/DeclarationName.cpp:119-125
   if (const RecordType *ClassRec = ClassType->getAs<RecordType>()) {
-    OS << *ClassRec->getDecl();
+    ClassRec->getDecl()->printName(OS, Policy);
     return;
   }
   if (Policy.SuppressTemplateArgsInCXXConstructors) {
     if (auto *InjTy = ClassType->getAs<InjectedClassNameType>()) {
+      InjTy->getDecl()->printName(OS, Policy);
----------------
This isn't the right way to go about this -- the diagnostic engine knows how to 
print a `NamedDecl` when given one, and that's what should be fixed. (We pass 
in a `NamedDecl` all over the place -- it's preferred to passing in a string.)

https://github.com/llvm/llvm-project/blob/b893368fd4fdf40b7778df8d0b17312def1a8156/clang/lib/AST/ASTDiagnostic.cpp#L460
 is one place where that happens, and 
https://github.com/llvm/llvm-project/blob/b893368fd4fdf40b7778df8d0b17312def1a8156/clang/lib/Basic/Diagnostic.cpp#L1060
 is another, so I'd start investigating from there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149272

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

Reply via email to