[clang] [clang][ssaf] Add cpp-bounded-buffers source transformation (PR #210457)
Ziqing Luo via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 14 23:36:07 PDT 2026
ziqingluo-90 wrote:
@steakhal I take this PR from Jan.
I did a major change in addition to addressing comments:
The main change is to narrow the rewrite range:
For pointers, let T mark the spelling of the pointee type according to
its TypeLoc:
```
other-specifiers cv-qualifiers T * other-specifiers pointer-name
|--- rewrite ---|
```
The rewrite range starts at the leading cv-qualifiers and ends at the
STAR of the pointer. other-specifiers before the leading cv-qualifiers
and after the STAR do not belong to the pointee type; they are
therefore left untouched, regardless of whether they are macros or
not. There should be nothing but trailing cv-qualifiers between T and
the STAR; those cv-qualifiers do belong to the pointee type, so they
are included in the rewrite range.
For arrays, let T mark the spelling of the element type according to
its TypeLoc:
```
other-specifiers cv-qualifiers T cv-qualifiers other-specifiers array-name [N]
|--------- rewrite ---------|
```
The rewrite range starts at the leading cv-qualifiers and ends at the
trailing cv-qualifiers. other-specifiers do not belong to the element
type, so if any token intervenes between T and the trailing
cv-qualifiers, the function fails to find a rewrite range and bails.
https://github.com/llvm/llvm-project/pull/210457
More information about the cfe-commits
mailing list