[all-commits] [llvm/llvm-project] 176bf5: [clang][NFC] Move Bounds Safety Sema code to `Sema...

Dan Liew via All-commits all-commits at lists.llvm.org
Fri Jul 19 05:06:49 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 176bf50cd244505e38f8838a55568060dd3913e8
      https://github.com/llvm/llvm-project/commit/176bf50cd244505e38f8838a55568060dd3913e8
  Author: Dan Liew <dan at su-root.co.uk>
  Date:   2024-07-19 (Fri, 19 Jul 2024)

  Changed paths:
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/CMakeLists.txt
    A clang/lib/Sema/SemaBoundsSafety.cpp
    M clang/lib/Sema/SemaDeclAttr.cpp

  Log Message:
  -----------
  [clang][NFC] Move Bounds Safety Sema code to `SemaBoundsSafety.cpp` (#99330)

This patch adds a new `SemaBoundsSafety.cpp` source file and moves the
existing `CheckCountedByAttrOnField` function and related helper
functions and types from `SemaDeclAttr.cpp` into the new source file.
The `CheckCountedByAttrOnField` function is now a method on the Sema
class and now has doxygen comments.

The goal behind this refactor is to clearly separate the
`-fbounds-safety` Sema code from everything else.

Although `counted_by(_or_null)` and `sized_by(_or_null)` attributes have
a meaning outside of `-fbounds-safety` it seems reasonable to also have
the Sema logic live in `SemaBoundsSafety.cpp` since the intention is
that the attributes will have the same semantics (but not necessarily
the same enforcement).

As `-fbounds-safety` is upstreamed additional Sema checks will be added
to `SemaBoundsSafety.cpp`.

rdar://131777237



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list