dankm updated this revision to Diff 530563. dankm added a comment. Rebase and hopefully fix builds.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152570/new/ https://reviews.llvm.org/D152570 Files: clang/docs/ReleaseNotes.rst clang/lib/AST/Expr.cpp clang/test/CodeGenCXX/file-prefix-map-lambda.cpp Index: clang/test/CodeGenCXX/file-prefix-map-lambda.cpp =================================================================== --- /dev/null +++ clang/test/CodeGenCXX/file-prefix-map-lambda.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fmacro-prefix-map=%p=./UNLIKELY_PATH/empty -S %s -emit-llvm -o - | FileCheck %s + +template<typename f> +auto lambdatest(f&& cb) { + const char *s = __PRETTY_FUNCTION__; + return s; +} + +int main() { + auto *s = lambdatest([](){}); +// CHECK: @"__PRETTY_FUNCTION__._Z10lambdatestIZ4mainE3$_0EDaOT_" = private unnamed_addr constant [{{[0-9]+}} x i8] c"auto lambdatest(f &&) [f = (lambda at ./UNLIKELY_PATH/empty{{/|\\\\}}{{.*}}.cpp:10:24)]\00", align 1 + + return 0; +} 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 &LO) : LO(LO) {} + 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 @@ -497,6 +497,8 @@ - CallExpr built for C error-recovery now is always type-dependent. Fixes a crash when we encounter a unresolved TypoExpr during diagnostic emission. (`#50244 <https://github.com/llvm/llvm-project/issues/50244>_`). +- Fix lambdas in template arguments not respecting ``-fmacro-prefix-map`` + (`#63219 <https://github.com/llvm/llvm-project/issues/63219>`_) Bug Fixes to Compiler Builtins ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Index: clang/test/CodeGenCXX/file-prefix-map-lambda.cpp =================================================================== --- /dev/null +++ clang/test/CodeGenCXX/file-prefix-map-lambda.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fmacro-prefix-map=%p=./UNLIKELY_PATH/empty -S %s -emit-llvm -o - | FileCheck %s + +template<typename f> +auto lambdatest(f&& cb) { + const char *s = __PRETTY_FUNCTION__; + return s; +} + +int main() { + auto *s = lambdatest([](){}); +// CHECK: @"__PRETTY_FUNCTION__._Z10lambdatestIZ4mainE3$_0EDaOT_" = private unnamed_addr constant [{{[0-9]+}} x i8] c"auto lambdatest(f &&) [f = (lambda at ./UNLIKELY_PATH/empty{{/|\\\\}}{{.*}}.cpp:10:24)]\00", align 1 + + return 0; +} 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 &LO) : LO(LO) {} + 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 @@ -497,6 +497,8 @@ - CallExpr built for C error-recovery now is always type-dependent. Fixes a crash when we encounter a unresolved TypoExpr during diagnostic emission. (`#50244 <https://github.com/llvm/llvm-project/issues/50244>_`). +- Fix lambdas in template arguments not respecting ``-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