Author: Chuanqi Xu Date: 2025-06-25T14:12:32+08:00 New Revision: a0ce3e691c199145b55b6a7f86468b438eb14264
URL: https://github.com/llvm/llvm-project/commit/a0ce3e691c199145b55b6a7f86468b438eb14264 DIFF: https://github.com/llvm/llvm-project/commit/a0ce3e691c199145b55b6a7f86468b438eb14264.diff LOG: [C++20] [Modules] Avoid crash with calls to (this auto) syntax Due to we didn't consider (this, auto) information when setting abbrev for calls, we use incorrect format for calls, which cause crashes. From https://github.com/llvm/llvm-project/issues/118137 Added: clang/test/Modules/pr118137.cppm Modified: clang/lib/Serialization/ASTWriterStmt.cpp Removed: ################################################################################ diff --git a/clang/lib/Serialization/ASTWriterStmt.cpp b/clang/lib/Serialization/ASTWriterStmt.cpp index a6e320c7f3eb0..87536be8c8d98 100644 --- a/clang/lib/Serialization/ASTWriterStmt.cpp +++ b/clang/lib/Serialization/ASTWriterStmt.cpp @@ -971,7 +971,7 @@ void ASTStmtWriter::VisitCallExpr(CallExpr *E) { Record.push_back(E->getFPFeatures().getAsOpaqueInt()); if (!E->hasStoredFPFeatures() && !static_cast<bool>(E->getADLCallKind()) && - E->getStmtClass() == Stmt::CallExprClass) + !E->usesMemberSyntax() && E->getStmtClass() == Stmt::CallExprClass) AbbrevToUse = Writer.getCallExprAbbrev(); Code = serialization::EXPR_CALL; diff --git a/clang/test/Modules/pr118137.cppm b/clang/test/Modules/pr118137.cppm new file mode 100644 index 0000000000000..38e35399b05c0 --- /dev/null +++ b/clang/test/Modules/pr118137.cppm @@ -0,0 +1,24 @@ +// RUN: rm -rf %t +// RUN: mkdir -p %t +// RUN: split-file %s %t +// +// RUN: %clang_cc1 -std=c++23 %t/a.cppm -emit-module-interface -o %t/a.pcm +// RUN: %clang_cc1 -std=c++23 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm +// RUN: %clang_cc1 -std=c++23 %t/a.cppm -emit-llvm -o - + +//--- a.h +typedef int nghttp2_session_callbacks; + +//--- a.cppm +module; +#include "a.h" +export module g; +template <typename, typename T> +concept Deleter = requires(T ptr) { ptr; }; +template <typename T, Deleter<T>> struct Handle { + void GetRaw(this auto); +}; +struct SessionCallbacksDeleter + : Handle<nghttp2_session_callbacks, SessionCallbacksDeleter> { +} Server_callbacks; +void Server() { Server_callbacks.GetRaw(); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits