Skip to content
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
19 changes: 19 additions & 0 deletions Sources/SWBUniversalPlatform/Specs/Clang.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -2934,6 +2934,25 @@
NO = ();
};
},
{
Name = "CLANG_OMIT_FRAME_POINTERS";
Type = Enumeration;
Values = (
"compiler-default",
YES,
NO,
);
CommandLineArgs = {
YES = (
"-fomit-frame-pointer",
);
NO = (
"-fno-omit-frame-pointer",
);
"<<otherwise>>" = ();
};
DefaultValue = "compiler-default";
},
// Index-while-building options, not visible in build settings.
{
Name = "CLANG_INDEX_STORE_PATH";
Expand Down
19 changes: 19 additions & 0 deletions Sources/SWBUniversalPlatform/Specs/Swift.xcspec
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,25 @@
DefaultValue = "$(DEBUG_INFORMATION_VERSION)";
Condition = "$(GCC_GENERATE_DEBUGGING_SYMBOLS) && $(DEBUG_INFORMATION_FORMAT) != \"\"";
},
{
Name = "SWIFT_OMIT_FRAME_POINTERS";
Type = Enumeration;
Values = (
"compiler-default",
YES,
NO,
);
CommandLineArgs = {
YES = (
"-Xcc", "-fomit-frame-pointer",
);
NO = (
"-Xcc", "-fno-omit-frame-pointer",
);
"<<otherwise>>" = ();
};
DefaultValue = "compiler-default";
},
{
Name = "CLANG_MODULE_CACHE_PATH";
Type = Path;
Expand Down
74 changes: 74 additions & 0 deletions Tests/SWBTaskConstructionTests/TaskConstructionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8583,6 +8583,80 @@ fileprivate struct TaskConstructionTests: CoreBasedTests {
}
}

@Test(.requireSDKs(.host))
func framePointerControl() async throws {
try await withTemporaryDirectory { tmpDir in
let testProject = try await TestProject(
"aProject",
sourceRoot: tmpDir,
groupTree: TestGroup(
"SomeFiles", path: "Sources",
children: [
TestFile("SourceFile.c"),
TestFile("Source.swift"),
]),
buildConfigurations: [
TestBuildConfiguration("Debug", buildSettings: [
"SWIFT_EXEC": swiftCompilerPath.str,
"SWIFT_VERSION": swiftVersion,
])
],
targets: [
TestStandardTarget(
"Library",
type: .dynamicLibrary,
buildConfigurations: [
TestBuildConfiguration("Debug")
],
buildPhases: [
TestSourcesBuildPhase([
"SourceFile.c",
"Source.swift"
])
]
)]
)

let fs = PseudoFS()

let core = try await getCore()
let tester = try TaskConstructionTester(core, testProject)

await tester.checkBuild(BuildParameters(configuration: "Debug", overrides: [:]), runDestination: .host, fs: fs) { results in
results.checkTask(.matchRuleType("CompileC")) { task in
task.checkCommandLineDoesNotContain("-fomit-frame-pointer")
task.checkCommandLineDoesNotContain("-fno-omit-frame-pointer")
}
results.checkTask(.matchRuleType("SwiftDriver Compilation")) { task in
task.checkCommandLineDoesNotContain("-fomit-frame-pointer")
task.checkCommandLineDoesNotContain("-fno-omit-frame-pointer")
}
}

await tester.checkBuild(BuildParameters(configuration: "Debug", overrides: ["CLANG_OMIT_FRAME_POINTERS": "YES", "SWIFT_OMIT_FRAME_POINTERS": "YES"]), runDestination: .host, fs: fs) { results in
results.checkTask(.matchRuleType("CompileC")) { task in
task.checkCommandLineContains(["-fomit-frame-pointer"])
task.checkCommandLineDoesNotContain("-fno-omit-frame-pointer")
}
results.checkTask(.matchRuleType("SwiftDriver Compilation")) { task in
task.checkCommandLineContains(["-Xcc", "-fomit-frame-pointer"])
task.checkCommandLineDoesNotContain("-fno-omit-frame-pointer")
}
}

await tester.checkBuild(BuildParameters(configuration: "Debug", overrides: ["CLANG_OMIT_FRAME_POINTERS": "NO", "SWIFT_OMIT_FRAME_POINTERS": "NO"]), runDestination: .host, fs: fs) { results in
results.checkTask(.matchRuleType("CompileC")) { task in
task.checkCommandLineDoesNotContain("-fomit-frame-pointer")
task.checkCommandLineContains(["-fno-omit-frame-pointer"])
}
results.checkTask(.matchRuleType("SwiftDriver Compilation")) { task in
task.checkCommandLineDoesNotContain("-fomit-frame-pointer")
task.checkCommandLineContains(["-Xcc", "-fno-omit-frame-pointer"])
}
}
}
}

@Test(.requireSDKs(.macOS))
func warningSuppression() async throws {
try await withTemporaryDirectory { tmpDir in
Expand Down
Loading