Skip to content

Commit 9db99a0

Browse files
committed
build-script: Implement support for --(no-)lldb-assertions
* LLDB assertions are on by default, like swift assertions * LLDB assertions can be enabled/disabled globally with the --assertions and --no-assertions options Partially addresses: rdar://38524846
1 parent 6df106e commit 9db99a0

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

utils/build-script

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,8 @@ class BuildScriptInvocation(object):
490490
args.swift_analyze_code_coverage).lower(),
491491
"--llbuild-enable-assertions", str(
492492
args.llbuild_assertions).lower(),
493+
"--lldb-assertions", str(
494+
args.lldb_assertions).lower(),
493495
"--cmake-generator", args.cmake_generator,
494496
"--build-jobs", str(args.build_jobs),
495497
"--common-cmake-options=%s" % ' '.join(

utils/build-script-impl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ KNOWN_SETTINGS=(
5959
lldb-test-swift-only "1" "when running lldb tests, only include Swift-specific tests"
6060
lldb-no-debugserver "" "delete debugserver after building it, and don't try to codesign it"
6161
lldb-use-system-debugserver "" "don't try to codesign debugserver, and use the system's debugserver instead"
62+
lldb-assertions "1" "build lldb with assertions enabled"
6263
llvm-build-type "Debug" "the CMake build variant for LLVM and Clang (Debug, RelWithDebInfo, Release, MinSizeRel). Defaults to Debug."
6364
swift-build-type "Debug" "the CMake build variant for Swift"
6465
swift-enable-assertions "1" "enable assertions in Swift"
@@ -1781,6 +1782,12 @@ function set_lldb_xcodebuild_options() {
17811782
-enableUndefinedBehaviorSanitizer=YES
17821783
)
17831784
fi
1785+
if [[ "$(true_false ${LLDB_ASSERTIONS})" == "FALSE" ]]; then
1786+
lldb_xcodebuild_options=(
1787+
"${lldb_xcodebuild_options[@]}"
1788+
OTHER_CFLAGS="-DNDEBUG"
1789+
)
1790+
fi
17841791
}
17851792

17861793
#

utils/build_swift/driver_arguments.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ def _apply_default_arguments(args):
108108
if args.llbuild_assertions is None:
109109
args.llbuild_assertions = args.assertions
110110

111+
if args.lldb_assertions is None:
112+
args.lldb_assertions = args.assertions
113+
111114
# Set the default CMake generator.
112115
if args.cmake_generator is None:
113116
args.cmake_generator = 'Ninja'

utils/build_swift/tests/expected_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
'libicu_build_variant': 'Debug',
137137
'lit_args': '-sv',
138138
'llbuild_assertions': True,
139-
'lldb_assertions': None,
139+
'lldb_assertions': True,
140140
'lldb_build_variant': 'Debug',
141141
'lldb_build_with_xcode': '1',
142142
'llvm_assertions': True,

0 commit comments

Comments
 (0)