dankm created this revision. Herald added a project: All. dankm added a comment. dankm updated this revision to Diff 530046. dankm published this revision for review. Herald added a project: clang. Herald added a subscriber: cfe-commits.
I still need to make a unit test for this. Should be more-or-less a cleaned up version of the testcase in https://github.com/llvm/llvm-project/issues/63219. dankm added a comment. Add release notes. dankm added a comment. Despite needing unit tests, I'd like some eyes on this change. When expanding template arguments for pretty function printing, such as for __PRETTY_FUNCTION__, apply macro-prefix-map remapping for lambda names. Fixes https://github.com/llvm/llvm-project/issues/63219 Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D152570 Files: clang/docs/ReleaseNotes.rst clang/lib/AST/Expr.cpp Index: clang/lib/AST/Expr.cpp =================================================================== --- clang/lib/AST/Expr.cpp +++ clang/lib/AST/Expr.cpp @@ -786,7 +786,21 @@ Out << "static "; } + class PrettyCallbacks final : public PrintingCallbacks { + public: + PrettyCallbacks(const LangOptions &L) : LO(L) {} + std::string remapPath(StringRef Path) const override { + SmallString<128> p(Path); + LO.remapPathPrefix(p); + return std::string(p); + } + + private: + const LangOptions &LO; + }; PrintingPolicy Policy(Context.getLangOpts()); + PrettyCallbacks PrettyCB(Context.getLangOpts()); + Policy.Callbacks = &PrettyCB; std::string Proto; llvm::raw_string_ostream POut(Proto); Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -492,6 +492,8 @@ (`See patch <https://reviews.llvm.org/D152303>`_). - Fix crash when passing a value larger then 64 bits to the aligned attribute. (`#50534 <https://github.com/llvm/llvm-project/issues/50534>`_). +- Fix lambdas in template arguments ``-fmacro-prefix-map`` + (`#63219 <https://github.com/llvm/llvm-project/issues/63219>`_) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Index: clang/lib/AST/Expr.cpp =================================================================== --- clang/lib/AST/Expr.cpp +++ clang/lib/AST/Expr.cpp @@ -786,7 +786,21 @@ Out << "static "; } + class PrettyCallbacks final : public PrintingCallbacks { + public: + PrettyCallbacks(const LangOptions &L) : LO(L) {} + std::string remapPath(StringRef Path) const override { + SmallString<128> p(Path); + LO.remapPathPrefix(p); + return std::string(p); + } + + private: + const LangOptions &LO; + }; PrintingPolicy Policy(Context.getLangOpts()); + PrettyCallbacks PrettyCB(Context.getLangOpts()); + Policy.Callbacks = &PrettyCB; std::string Proto; llvm::raw_string_ostream POut(Proto); Index: clang/docs/ReleaseNotes.rst =================================================================== --- clang/docs/ReleaseNotes.rst +++ clang/docs/ReleaseNotes.rst @@ -492,6 +492,8 @@ (`See patch <https://reviews.llvm.org/D152303>`_). - Fix crash when passing a value larger then 64 bits to the aligned attribute. (`#50534 <https://github.com/llvm/llvm-project/issues/50534>`_). +- Fix lambdas in template arguments ``-fmacro-prefix-map`` + (`#63219 <https://github.com/llvm/llvm-project/issues/63219>`_) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits