Support enabling tsan and ubsan from Xcode UI
Xcode won't let you enable ubsan from the UI as it requires a
'Compile Sources' phase with (Objective-)C(++) sources, but if you
manually edit the scheme and enable it or equivalently add the phase
with a dummy file, enable it from the UI, and then remove the phase,
ubsan will work.
PiperOrigin-RevId: 196831918
diff --git a/src/TulsiGenerator/Scripts/bazel_options.py b/src/TulsiGenerator/Scripts/bazel_options.py
index 049f2f1..dc05b05 100755
--- a/src/TulsiGenerator/Scripts/bazel_options.py
+++ b/src/TulsiGenerator/Scripts/bazel_options.py
@@ -33,8 +33,10 @@
"""Returns a list of bazel flags for the current Xcode env configuration."""
flags = []
if self.xcode_env.get('ENABLE_ADDRESS_SANITIZER') == 'YES':
- flags.extend([
- '--features=asan',
- ])
+ flags.append('--features=asan')
+ if self.xcode_env.get('ENABLE_THREAD_SANITIZER') == 'YES':
+ flags.append('--features=tsan')
+ if self.xcode_env.get('ENABLE_UNDEFINED_BEHAVIOR_SANITIZER') == 'YES':
+ flags.append('--features=ubsan')
return flags