ITADN

[BoundsSafety] Move LateParsedAttribute outside Parser class; move LateParsedAttrList to DeclSpec.h

#12764Openrapidsna 创建于 2026-04-14
clang:bounds-safety
R
rapidsnacommented
**Part of**: Late Parsing Refactoring for Bounds Safety Type Attributes (see llvm/llvm-project#179612) **Phase**: 0 (no dependencies, can be done immediately) **Type**: Cherry-pick from upstream ## Description Cherry-pick the structural moves from the upstream PR llvm/llvm-project#179612: 1. Move `LateParsedDeclaration` and `LateParsedAttribute` from inside the `Parser` class to namespace level (stay in `Parser.h`) 2. Move `LateParsedAttrList` from `Parser.h` to `DeclSpec.h` 3. Forward-declare `LateParsedAttribute` in `DeclSpec.h` (opaque) 4. Replace `LateParsedAttrInfo` usage in `DeclaratorChunk` with `LateParsedAttribute*` 5. Remove `LateParsedAttrInfo` ## Why The new late parsing approach stores `LateParsedAttribute` pointers in `DeclaratorChunk`, `Declarator`, and `DeclSpec` to track late attributes at each declarator level. These types must be accessible from `DeclSpec.h`, which cannot depend on `Parser.h`. Currently `DeclSpec.h` defines its own `LateParsedAttrInfo` struct as a workaround — this should be replaced with the real `LateParsedAttribute` type. ## Key files - `clang/include/clang/Parse/Parser.h` — `LateParsedDeclaration` at line 1133, `LateParsedAttribute` at line 1172 - `clang/include/clang/Sema/DeclSpec.h` — `LateParsedAttrInfo` at line 1277 ## Validation All existing lit tests must pass: `llvm-lit --filter='counted-by|bounds-safety|sized-by' clang/test` and `llvm-lit clang/test/BoundsSafety`
0 条评论