llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Macro Terra (hongtaihu) <details> <summary>Changes</summary> Re-enable the `v<char>` and `v<int>` static data member initializers in `CodeGenCXX/msabi-blocks.cpp`. Add X86/X64 DAG checks for each class static member and the local static variable inside its block initializer, following the existing symbol checks in this file. The checks distinguish the template specializations, block scopes, and variable types. The example was disabled when the file was introduced by 3cc6d0bc67ca (2017). Its template-instantiation crash was fixed by a3a462e5ca57789a5bc9f892f27a4d120f03b4c3 (D49688, July 23, 2018): `InstantiateClass` skips standalone `BlockDecl`s and leaves their instantiation to the containing `BlockExpr`.This was validated by native X86 Release builds with assertions enabled at a3a462e5ca57 and its parent f96de0296023. The isolated template example and the complete restored file both crash with `Unexpected decl` on the parent and compile successfully on the fix. Prepared with assistance from Codex. --- Full diff: https://github.com/llvm/llvm-project/pull/241906.diff 1 Files Affected: - (modified) clang/test/CodeGenCXX/msabi-blocks.cpp (+8-2) ``````````diff diff --git a/clang/test/CodeGenCXX/msabi-blocks.cpp b/clang/test/CodeGenCXX/msabi-blocks.cpp index dc30bdd99f7b9c..d0c0320a3107ff 100644 --- a/clang/test/CodeGenCXX/msabi-blocks.cpp +++ b/clang/test/CodeGenCXX/msabi-blocks.cpp @@ -98,7 +98,6 @@ void j(void) { struct t::u t; } -#if 0 template <typename T> struct v { static T i; @@ -109,5 +108,12 @@ T v<T>::i = ^{ static T i = T(); return i; }(); template class v<char>; template class v<int>; -#endif +// CHECK-X86-DAG: @"?i@?$v@D@@2DA" = weak_odr dso_local global i8 0 +// CHECK-X86-DAG: @"?i@?1??_block_invoke_1@0?$v@D@@YAXPAU__block_literal_1@@@Z@4DA" = linkonce_odr dso_local global i8 0 +// CHECK-X86-DAG: @"?i@?$v@H@@2HA" = weak_odr dso_local global i32 0 +// CHECK-X86-DAG: @"?i@?1??_block_invoke_1@0?$v@H@@YAXPAU__block_literal_1@@@Z@4HA" = linkonce_odr dso_local global i32 0 +// CHECK-X64-DAG: @"?i@?$v@D@@2DA" = weak_odr dso_local global i8 0 +// CHECK-X64-DAG: @"?i@?1??_block_invoke_1@0?$v@D@@YAXPEAU__block_literal_1@@@Z@4DA" = linkonce_odr dso_local global i8 0 +// CHECK-X64-DAG: @"?i@?$v@H@@2HA" = weak_odr dso_local global i32 0 +// CHECK-X64-DAG: @"?i@?1??_block_invoke_1@0?$v@H@@YAXPEAU__block_literal_1@@@Z@4HA" = linkonce_odr dso_local global i32 0 `````````` </details> https://github.com/llvm/llvm-project/pull/241906 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
