From c704557b4280f8ec7229f5ffc7ec37ec8cac4080 Mon Sep 17 00:00:00 2001 From: thetruestblue Date: Thu, 24 Apr 2025 15:36:53 -0700 Subject: [PATCH] Add new libcxx flag for disabling container overflow checks libcxx changed the name of the macro used to include sanitizer container annotations. We should add the new flag name to maintain current behavior. Sanitizer container overflow checks are prone to false positives, so we default to disabling these on xcode projects. rdar://149350723 --- Sources/SWBUniversalPlatform/Specs/Clang LLVM 1.0.xcspec | 1 + Tests/SWBTaskConstructionTests/TaskConstructionTests.swift | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Sources/SWBUniversalPlatform/Specs/Clang LLVM 1.0.xcspec b/Sources/SWBUniversalPlatform/Specs/Clang LLVM 1.0.xcspec index fcdfeda1..aeee0c18 100644 --- a/Sources/SWBUniversalPlatform/Specs/Clang LLVM 1.0.xcspec +++ b/Sources/SWBUniversalPlatform/Specs/Clang LLVM 1.0.xcspec @@ -2736,6 +2736,7 @@ YES = (); NO = ( "-D_LIBCPP_HAS_NO_ASAN", + "-D_LIBCPP_HAS_ASAN=0", ); }; Condition = "$(CLANG_ADDRESS_SANITIZER)"; diff --git a/Tests/SWBTaskConstructionTests/TaskConstructionTests.swift b/Tests/SWBTaskConstructionTests/TaskConstructionTests.swift index 4511d270..570aed47 100644 --- a/Tests/SWBTaskConstructionTests/TaskConstructionTests.swift +++ b/Tests/SWBTaskConstructionTests/TaskConstructionTests.swift @@ -4135,7 +4135,7 @@ fileprivate struct TaskConstructionTests: CoreBasedTests { // There should be one CompileC task, which includes the ASan option, and which puts its output in a -asan directory. results.checkTask(.matchTarget(target), .matchRuleType("CompileC")) { task in task.checkRuleInfo([.equal("CompileC"), .equal("\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/x86_64/SourceFile.o"), .suffix("SourceFile.m"), .any, .any, .any, .any]) - task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", "-fsanitize=address", "-D_LIBCPP_HAS_NO_ASAN", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/x86_64/SourceFile.o"]) + task.checkCommandLineContains(["\(core.developerPath.path.str)/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang", "-fsanitize=address", "-D_LIBCPP_HAS_NO_ASAN", "-D_LIBCPP_HAS_ASAN=0", "\(SRCROOT)/build/aProject.build/Debug/\(targetName).build/Objects-normal-asan/x86_64/SourceFile.o"]) } // There should be one CompileSwiftSources task, which includes the ASan option, and which puts its output in a -asan directory.