Skip to content

[clang] Default to -fno-sized-deallocation for AIX #97076

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions clang/lib/Driver/ToolChains/AIX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 5 additions & 0 deletions clang/unittests/StaticAnalyzer/CallEventTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ TEST(CXXDeallocatorCall, SimpleDestructor) {
}
)",
Diags));
#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");
#endif
}

} // namespace
Expand Down
Loading