rapidsna wrote: @zmodem Alright, I managed to move `LateParsedAttribute` and `LateParsedTypeAttribute` back to `Parser.h` (outside of the `Parser` class). `LateParsedAttrList` still lives in `DeclSpec.h` though, since `DeclSpec` needs to hold it as a member.
To keep `LateParsedAttrList` from depending on `LateParsedAttribute`'s full definition, I replaced the `LateParsedTypeAttribute::takeLateTypeAttributesAppendingFrom` member function with a static Parser method `Parser::TakeTypeAttrsAppendingFrom`. The tricky part was giving Sema access to `LateParsedTypeAttribute` details without creating a layering violation. For this, I added two callbacks to Sema: - `GetLateParsedAttributeLocationCallback`: Grabs the `AttrNameLoc` from a `LateParsedTypeAttribute` so we can fill in `TypeLoc` properly. - `ProcessLateParsedTypeAttrCallback`: Validates the counted_by-family attribute type and wraps it in a `LateParsedAttrType` node. Both callbacks get registered in `Parser::Initialize` via `SetLateParsedAttributeCallbacks`, so they're available throughout parsing whenever Sema processes types and triggers late parsing. Please take a look! https://github.com/llvm/llvm-project/pull/179612 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
