dankm created this revision. dankm added a reviewer: MaskRay. Herald added a project: All. dankm requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Rather than sending a name directly to the stream, use printName to preserve any PrintingPolicy. This ensures that names are properly affected by path remapping. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D149272 Files: clang/lib/AST/Decl.cpp clang/lib/AST/DeclarationName.cpp Index: clang/lib/AST/DeclarationName.cpp =================================================================== --- clang/lib/AST/DeclarationName.cpp +++ clang/lib/AST/DeclarationName.cpp @@ -117,12 +117,12 @@ Policy.adjustForCPlusPlus(); 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>()) { - OS << *InjTy->getDecl(); + InjTy->getDecl()->printName(OS, Policy); return; } } Index: clang/lib/AST/Decl.cpp =================================================================== --- clang/lib/AST/Decl.cpp +++ clang/lib/AST/Decl.cpp @@ -1635,8 +1635,8 @@ llvm_unreachable("unknown module kind"); } -void NamedDecl::printName(raw_ostream &OS, const PrintingPolicy&) const { - OS << Name; +void NamedDecl::printName(raw_ostream &OS, const PrintingPolicy &Policy) const { + Name.print(OS, Policy); } void NamedDecl::printName(raw_ostream &OS) const {
Index: clang/lib/AST/DeclarationName.cpp =================================================================== --- clang/lib/AST/DeclarationName.cpp +++ clang/lib/AST/DeclarationName.cpp @@ -117,12 +117,12 @@ Policy.adjustForCPlusPlus(); 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>()) { - OS << *InjTy->getDecl(); + InjTy->getDecl()->printName(OS, Policy); return; } } Index: clang/lib/AST/Decl.cpp =================================================================== --- clang/lib/AST/Decl.cpp +++ clang/lib/AST/Decl.cpp @@ -1635,8 +1635,8 @@ llvm_unreachable("unknown module kind"); } -void NamedDecl::printName(raw_ostream &OS, const PrintingPolicy&) const { - OS << Name; +void NamedDecl::printName(raw_ostream &OS, const PrintingPolicy &Policy) const { + Name.print(OS, Policy); } void NamedDecl::printName(raw_ostream &OS) const {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits