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
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits