================
@@ -186,4 +218,370 @@ bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr
*E, bool CountInBytes,
return false;
}
+SourceRange Sema::BoundsSafetySourceRangeFor(const CountAttributedType *CATy) {
----------------
Sirraide wrote:
This entire function seems like a very bad idea to me: I don’t think Sema
should ever have to fiddle with source locations in terms of character offsets
or anything like that. This seems extremely brittle in case a user writes
something like e.g. `__counted_by ( count )` or uses macros (which you
mention in a comment doesn’t work).
I think you should be able to get a hold of the corresponding
`CountAttributedTypeLoc` somehow (e.g. via the `FieldDecl`, which has a
`TypeSourceInfo*`, which you should be able to get the type loc from; you might
have to do this a few levels up the call stack before we ever get here) and
then use its source location and range.
https://github.com/llvm/llvm-project/pull/106321
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits