https://github.com/xingxue-ibm updated https://github.com/llvm/llvm-project/pull/97076
>From d6a486c4f007297d087fe4454da3ec501e824825 Mon Sep 17 00:00:00 2001 From: Xing Xue <xing...@outlook.com> Date: Fri, 28 Jun 2024 11:25:25 -0400 Subject: [PATCH 1/2] Default to -fno-sized-deallocation for AIX. --- clang/lib/Driver/ToolChains/AIX.cpp | 6 ++++++ clang/unittests/StaticAnalyzer/CallEventTest.cpp | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/clang/lib/Driver/ToolChains/AIX.cpp b/clang/lib/Driver/ToolChains/AIX.cpp index 381d72e045b95..b04502a57a9f7 100644 --- a/clang/lib/Driver/ToolChains/AIX.cpp +++ b/clang/lib/Driver/ToolChains/AIX.cpp @@ -551,6 +551,12 @@ void AIX::addClangTargetOptions( if (Args.hasFlag(options::OPT_fxl_pragma_pack, options::OPT_fno_xl_pragma_pack, true)) CC1Args.push_back("-fxl-pragma-pack"); + + // Pass "-fno-sized-deallocation" only when the user hasn't manually enabled + // or disabled sized deallocations. + if (!Args.getLastArgNoClaim(options::OPT_fsized_deallocation, + options::OPT_fno_sized_deallocation)) + CC1Args.push_back("-fno-sized-deallocation"); } void AIX::addProfileRTLibs(const llvm::opt::ArgList &Args, diff --git a/clang/unittests/StaticAnalyzer/CallEventTest.cpp b/clang/unittests/StaticAnalyzer/CallEventTest.cpp index 7c4132788ca7e..de28bb158ef66 100644 --- a/clang/unittests/StaticAnalyzer/CallEventTest.cpp +++ b/clang/unittests/StaticAnalyzer/CallEventTest.cpp @@ -76,7 +76,11 @@ TEST(CXXDeallocatorCall, SimpleDestructor) { } )", Diags)); +#if !defined(__cpp_sized_deallocation) + EXPECT_EQ(Diags, "test.CXXDeallocator: NumArgs: 1\n"); +#else EXPECT_EQ(Diags, "test.CXXDeallocator: NumArgs: 2\n"); +#endif } } // namespace >From 612f60e20ba45dd91cd6722a8df33410f452127e Mon Sep 17 00:00:00 2001 From: Xing Xue <xing...@outlook.com> Date: Sat, 29 Jun 2024 19:35:18 -0400 Subject: [PATCH 2/2] Guard the NumArgs check with OS macros instead of __cpp_sized_deallocation because the latter is not defined for the test. --- clang/unittests/StaticAnalyzer/CallEventTest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/unittests/StaticAnalyzer/CallEventTest.cpp b/clang/unittests/StaticAnalyzer/CallEventTest.cpp index de28bb158ef66..987162f9fdf34 100644 --- a/clang/unittests/StaticAnalyzer/CallEventTest.cpp +++ b/clang/unittests/StaticAnalyzer/CallEventTest.cpp @@ -76,7 +76,8 @@ TEST(CXXDeallocatorCall, SimpleDestructor) { } )", Diags)); -#if !defined(__cpp_sized_deallocation) +#if defined(_AIX) || defined(__MVS__) + // AIX and ZOS default to -fno-sized-deallocation. EXPECT_EQ(Diags, "test.CXXDeallocator: NumArgs: 1\n"); #else EXPECT_EQ(Diags, "test.CXXDeallocator: NumArgs: 2\n"); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits