Skip to content

[BoundsSafety] Rename experimental C++ and Objective-C flags and make them CC1 only #10668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

delcypher
Copy link

The existing -fbounds-attributes-cxx-experimental and -fbounds-attributes-objc-experimental flags were previously exposed as driver and CC1 flags. However, given that these modes are highly experimental we don't want to encourage their use so these flags have no been made CC1 only flags. The functionality is still available from the driver by doing -Xclang <flag name>.

This patch also does a rename of the flags to be prefixed with experimental- which upstream prefers.

  1. -fbounds-attributes-cxx-experimental -> -fexperimental-bounds-safety-cxx
  2. -fbounds-attributes-objc-experimental -> -fexperimental-bounds-safety-objc.

This patch also renames "bounds attributes" to "bounds safety" for things associated with these flags (e.g.
LangOptions::BoundsSafetyCXXExperimental). "bounds attributes" is the legacy name that we need to slowly purge from the codebase and this is one small step towards that goal.

rdar://149423268
(cherry picked from commit cf995c3)

This is a cherry-pick of #10635

Conflicts:
clang/test/BoundsSafety-legacy-checks/AST/SystemHeaders/builtin-function-main.c
clang/test/BoundsSafety/AST/builtin-memcpy-count-annotation.c
clang/test/BoundsSafety/AST/system-merge-dynamic-bound-attr.c
clang/test/BoundsSafety/AST/typedef-function-attrs-late-parsed-call.c
clang/test/BoundsSafety/AST/unify-auto.cpp
clang/test/BoundsSafety/CodeGen/compound-literal-counted_by-O2.c
clang/test/BoundsSafety/CodeGen/compound-literal-sized_by-O2.c
clang/test/BoundsSafety/CodeGen/ended_by_locals.c
clang/test/BoundsSafety/CodeGen/init-global-indexable-with-null.c
clang/test/BoundsSafety/CodeGen/terminated-by-to-indexable-loop-O2.c
clang/test/BoundsSafety/Sema/dynamic-count-ptr-null.c
clang/test/BoundsSafety/Sema/static-bound-ptr-init.c
clang/utils/bounds_safety_fixup_codegen_tests.sh

@delcypher delcypher self-assigned this May 12, 2025
@delcypher delcypher requested a review from a team as a code owner May 12, 2025 18:44
@delcypher delcypher added the clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang label May 12, 2025
… them CC1 only

The existing `-fbounds-attributes-cxx-experimental` and
`-fbounds-attributes-objc-experimental` flags were previously exposed as driver and
CC1 flags. However, given that these modes are highly experimental we
don't want to encourage their use so these flags have no been made CC1
only flags. The functionality is still available from the driver by
doing `-Xclang <flag name>`.

This patch also does a rename of the flags to be prefixed with
`experimental-` which upstream prefers.

1. `-fbounds-attributes-cxx-experimental` -> `-fexperimental-bounds-safety-cxx`
2. `-fbounds-attributes-objc-experimental` ->
  `-fexperimental-bounds-safety-objc`.

This patch also renames "bounds attributes" to "bounds safety" for
things associated with these flags (e.g.
`LangOptions::BoundsSafetyCXXExperimental`). "bounds attributes" is the
legacy name that we need to slowly purge from the codebase and this is
one small step towards that goal.

rdar://149423268
(cherry picked from commit cf995c3)

This is a cherry-pick of swiftlang#10635 .

Conflicts:
  clang/test/BoundsSafety-legacy-checks/AST/SystemHeaders/builtin-function-main.c
  clang/test/BoundsSafety/AST/builtin-memcpy-count-annotation.c
  clang/test/BoundsSafety/AST/system-merge-dynamic-bound-attr.c
  clang/test/BoundsSafety/AST/typedef-function-attrs-late-parsed-call.c
  clang/test/BoundsSafety/AST/unify-auto.cpp
  clang/test/BoundsSafety/CodeGen/compound-literal-counted_by-O2.c
  clang/test/BoundsSafety/CodeGen/compound-literal-sized_by-O2.c
  clang/test/BoundsSafety/CodeGen/ended_by_locals.c
  clang/test/BoundsSafety/CodeGen/init-global-indexable-with-null.c
  clang/test/BoundsSafety/CodeGen/terminated-by-to-indexable-loop-O2.c
  clang/test/BoundsSafety/Sema/dynamic-count-ptr-null.c
  clang/test/BoundsSafety/Sema/static-bound-ptr-init.c
  clang/utils/bounds_safety_fixup_codegen_tests.sh
@delcypher delcypher force-pushed the dliew/rdar-149423268-cherry-pick-swift-release-6.2 branch from e702a50 to bd84b03 Compare May 12, 2025 18:45
@delcypher
Copy link
Author

@swift-ci test

@delcypher
Copy link
Author

@swift-ci test llvm

@delcypher
Copy link
Author

@rapidsna Could you approve and merge this?

@rapidsna rapidsna merged commit f327405 into swiftlang:swift/release/6.2 May 13, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants