[clang] [BoundsSafety] Support bounds-safety attributes in type positions (PR #179612)

Yeoul Na via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 12 18:52:42 PST 2026


rapidsna wrote:

> > Whether `LateParsedAttribute` is in `Parser` or in `DeclSpec`, the fundamental problem is that this creates either an AST → Sema or AST → Parser dependency because `LateParsedAttrType` in AST references `LateParsedTypeAttribute`.
> 
> Right, but I think the idea is that the reference to `LateParsedTypeAttribute` should be opaque, since it's referencing state in the parser? The AST library shouldn't need to see through it.
> 
> > Currently, some AST code includes `DeclSpec.h` to access `AttrNameLoc` from `LateParsedTypeAttribute`. However, I think I can eliminate this dependency by storing the SourceLocation separately instead of accessing it through `LateParsedTypeAttribute`.
> > Would that address your concern about the AST → Sema dependency?
> 
> Yes, I think so.
> 
> It looks like `ASTContext.cpp` also includes `DeclSpec.h` for `ASTContext::getLateParsedAttrType`, but I don't think that actually needs the definition of `LateParsedTypeAttribute` -- a forward declaration should be enough (and it has one already, via Type.h -> TypeBase.h).

@zmodem I just updated PR as suggested.

https://github.com/llvm/llvm-project/pull/179612


More information about the cfe-commits mailing list