dankm updated this revision to Diff 518050. dankm added a comment. Rebase & add add release note.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D149272/new/ https://reviews.llvm.org/D149272 Files: clang/docs/ReleaseNotes.rst clang/lib/AST/Decl.cpp clang/lib/AST/DeclarationName.cpp clang/test/CodeGen/debug-prefix-map.cpp Index: clang/test/CodeGen/debug-prefix-map.cpp =================================================================== --- /dev/null +++ clang/test/CodeGen/debug-prefix-map.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=./UNLIKELY_PATH/empty -S %s -emit-llvm -o - | FileCheck %s + +struct alignas(64) an { + struct { + unsigned char x{0}; + } arr[64]; +}; + +struct an *pan = new an; + +// CHECK: !DISubprogram(name: "(unnamed struct at ./UNLIKELY_PATH/empty{{/|\\\\}}{{.*}}", 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/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -338,6 +338,8 @@ - Fix crash when attempting to perform parenthesized initialization of an aggregate with a base class with only non-public constructors. (`#62296 <https://github.com/llvm/llvm-project/issues/62296>`_) +- Fix lambdas and other anonymous function names not respecting ``-fdebug-prefix-map`` + (`#62192 <https://github.com/llvm/llvm-project/issues/62192>`_) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Index: clang/test/CodeGen/debug-prefix-map.cpp =================================================================== --- /dev/null +++ clang/test/CodeGen/debug-prefix-map.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -debug-info-kind=standalone -fdebug-prefix-map=%p=./UNLIKELY_PATH/empty -S %s -emit-llvm -o - | FileCheck %s + +struct alignas(64) an { + struct { + unsigned char x{0}; + } arr[64]; +}; + +struct an *pan = new an; + +// CHECK: !DISubprogram(name: "(unnamed struct at ./UNLIKELY_PATH/empty{{/|\\\\}}{{.*}}", 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/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -338,6 +338,8 @@ - Fix crash when attempting to perform parenthesized initialization of an aggregate with a base class with only non-public constructors. (`#62296 <https://github.com/llvm/llvm-project/issues/62296>`_) +- Fix lambdas and other anonymous function names not respecting ``-fdebug-prefix-map`` + (`#62192 <https://github.com/llvm/llvm-project/issues/62192>`_) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits