I'm building using the following options, but I cannot debug resulting swift-frontend
- debug info is present, but code is compiled with optimisations and I cannot view variables:
"$(dirname $0)/swift/utils/build-script" --skip-build-benchmarks \
--skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \
--sccache --release-debuginfo --debug-swift --debug-swift-stdlib --swift-disable-dead-stripping \
--force-optimized-typechecker --skip-early-swift-driver \
--bootstrapping=off \
--extra-cmake-options " -DSWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING=FALSE" \
--extra-cmake-options " -DSWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED=TRUE" \
--extra-cmake-options " -DSWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING=FALSE" \
--extra-cmake-options " -DSWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE=$(dirname $0)/swift-syntax"
Upon further investigation, I see that swift/lib/Sema/TypeCheckAttr.cpp
is compiled with the following parameters:
...
-isysroot
/Applications/Xcode-14.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
-F/../../../Developer/Library/Frameworks
-O0
-g
-UNDEBUG
-O3
-std=c++14
-MD
-MT
...
So, looks like -O3
overrides -O0
. Is this a bug in build-script
or am I using it wrong?