Skip to content

Commit 923cd49

Browse files
hnrklssnjroelofs
authored andcommitted
[UTC] Fix bounds safety default checks in update_cc_test_checks.py
Previously update_cc_test_checks.py would append the default bounds check flag to the end of the RUN line. If the original RUN line contained any bounds check flags they would be overridden by this. The default bounds check flag is now inserted immediately after the %clang_cc1 expansion, so that the RUN line can override it.
1 parent fab896e commit 923cd49

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

llvm/utils/update_cc_test_checks.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -358,11 +358,6 @@ def update_test(ti: common.TestInfo):
358358
# This is a clang runline, apply %clang substitution rule, do lit-like substitutions,
359359
# and append args.clang_args
360360
clang_args = exec_args
361-
# DO_NOT_UPSTREAM(BoundsSafety) ON
362-
original_subst = clang_args[0] # Apple Internal
363-
# DO_NOT_UPSTREAM(BoundsSafety) OFF
364-
clang_args[0:1] = SUBST[clang_args[0]]
365-
366361
# DO_NOT_UPSTREAM(BoundsSafety) ON
367362
# The -fbounds-safety tests under:
368363
#
@@ -377,16 +372,17 @@ def update_test(ti: common.TestInfo):
377372
#
378373
# This can be removed once support for the legacy bounds checks are
379374
# removed (rdar://134095901)
375+
original_subst = clang_args[0] # Apple Internal
380376
if is_bounds_safety_test_with_new_bounds_checks(ti) and original_subst == "%clang_cc1":
381-
enable_bounds_safety_checks_flag = '-fbounds-safety-bringup-missing-checks=batch_0'
382-
print(f"Implicitly adding {enable_bounds_safety_checks_flag}")
383-
clang_args.append(enable_bounds_safety_checks_flag)
384-
385-
if is_bounds_safety_test_with_legacy_bounds_checks(ti) and original_subst == "%clang_cc1":
386-
enable_bounds_safety_legacy_checks_flag = '-fno-bounds-safety-bringup-missing-checks=all'
387-
print(f"Implicitly adding {enable_bounds_safety_legacy_checks_flag}")
388-
clang_args.append(enable_bounds_safety_legacy_checks_flag)
377+
default_bounds_safety_checks_flag = ['-fbounds-safety-bringup-missing-checks=batch_0']
378+
print(f"Implicitly adding {default_bounds_safety_checks_flag[0]}")
379+
elif is_bounds_safety_test_with_legacy_bounds_checks(ti) and original_subst == "%clang_cc1":
380+
default_bounds_safety_checks_flag = ['-fno-bounds-safety-bringup-missing-checks=all']
381+
print(f"Implicitly adding {default_bounds_safety_checks_flag[0]}")
382+
else:
383+
default_bounds_safety_checks_flag = []
389384
# DO_NOT_UPSTREAM(BoundsSafety) OFF
385+
clang_args[0:1] = SUBST[clang_args[0]] + default_bounds_safety_checks_flag
390386

391387
for s in subs:
392388
clang_args = [i.replace(s, subs[s]) if s in i else i for i in clang_args]

0 commit comments

Comments
 (0)