https://github.com/kstoimenov updated https://github.com/llvm/llvm-project/pull/183428
>From 840a1078a42a782015ce1b1ac02bdfffca5461b1 Mon Sep 17 00:00:00 2001 From: Kirill Stoimenov <[email protected]> Date: Thu, 26 Feb 2026 01:13:00 +0000 Subject: [PATCH 1/3] [clang] Fixed a bug causing failure with CFI icalls enabled. --- clang/lib/AST/ItaniumMangle.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp index df00760fa911b..7c34377fc6e1a 100644 --- a/clang/lib/AST/ItaniumMangle.cpp +++ b/clang/lib/AST/ItaniumMangle.cpp @@ -423,7 +423,8 @@ class CXXNameMangler { : Context(C), Out(Out_), NormalizeIntegers(NormalizeIntegers_), NullOut(false), Structor(nullptr), AbiTagsRoot(AbiTags) {} CXXNameMangler(CXXNameMangler &Outer, raw_ostream &Out_) - : Context(Outer.Context), Out(Out_), Structor(Outer.Structor), + : Context(Outer.Context), Out(Out_), + NormalizeIntegers(Outer.NormalizeIntegers), Structor(Outer.Structor), StructorType(Outer.StructorType), SeqID(Outer.SeqID), FunctionTypeDepth(Outer.FunctionTypeDepth), AbiTagsRoot(AbiTags), Substitutions(Outer.Substitutions), >From bf2b0e14df5b195281665d2d7ef38d4824af6ca3 Mon Sep 17 00:00:00 2001 From: Kirill Stoimenov <[email protected]> Date: Thu, 26 Feb 2026 03:44:09 +0000 Subject: [PATCH 2/3] Added a test. --- .../CodeGen/cfi-icall-with-normalize-int.cpp | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 clang/test/CodeGen/cfi-icall-with-normalize-int.cpp diff --git a/clang/test/CodeGen/cfi-icall-with-normalize-int.cpp b/clang/test/CodeGen/cfi-icall-with-normalize-int.cpp new file mode 100644 index 0000000000000..1d60dbbafafa9 --- /dev/null +++ b/clang/test/CodeGen/cfi-icall-with-normalize-int.cpp @@ -0,0 +1,47 @@ +// RUN: %clang_cc1 -std=gnu++20 -fsanitize=cfi-icall -fsanitize-minimal-runtime \ +// RUN: -fsanitize-cfi-icall-experimental-normalize-integers \ +// RUN: -fsized-deallocation -flto=thin -std=gnu++20 -S %s -o- + +template <class _Fn> +void invoke(_Fn) { + return; +} + +template <class _Iter> +struct reverse_iterator { + _Iter operator*() { + _Iter __tmp; + *__tmp; + return __tmp; + } + void operator++(); +}; + +template <class _Iter1, class _Iter2> bool operator!=(_Iter1, _Iter2); + +template <typename _Fn> +struct __attribute__((__abi_tag__("v1"))) transform_view { + void operator*() { invoke(__func_); } + _Fn __func_; +}; + +template <typename It> +struct range { + It begin(); + It end(); +}; + +template <class> +struct VarargsNodeTMixin { + auto args() { + return transform_view([] {}); + } +}; + +struct Call : VarargsNodeTMixin<int> { + void GenerateCode(); +}; + +void Call::GenerateCode() { + for (auto item : range<reverse_iterator<decltype(args())>>{}) { } +} >From 1de1138d99fbcdc94935b6cec0ff472ffe544d2f Mon Sep 17 00:00:00 2001 From: Kirill Stoimenov <[email protected]> Date: Thu, 26 Feb 2026 16:25:46 +0000 Subject: [PATCH 3/3] Renamed the test and minimized the number of compiler flags needed. --- ...call-with-normalize-int.cpp => cfi-icall-with-abi-tag.cpp} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename clang/test/CodeGen/{cfi-icall-with-normalize-int.cpp => cfi-icall-with-abi-tag.cpp} (84%) diff --git a/clang/test/CodeGen/cfi-icall-with-normalize-int.cpp b/clang/test/CodeGen/cfi-icall-with-abi-tag.cpp similarity index 84% rename from clang/test/CodeGen/cfi-icall-with-normalize-int.cpp rename to clang/test/CodeGen/cfi-icall-with-abi-tag.cpp index 1d60dbbafafa9..3a38b9958d406 100644 --- a/clang/test/CodeGen/cfi-icall-with-normalize-int.cpp +++ b/clang/test/CodeGen/cfi-icall-with-abi-tag.cpp @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -std=gnu++20 -fsanitize=cfi-icall -fsanitize-minimal-runtime \ +// RUN: %clang_cc1 -std=c++20 -fsanitize=cfi-icall \ // RUN: -fsanitize-cfi-icall-experimental-normalize-integers \ -// RUN: -fsized-deallocation -flto=thin -std=gnu++20 -S %s -o- +// RUN: -S %s -o- template <class _Fn> void invoke(_Fn) { _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
