[BoundsSafety] Move late parsing for parameters trigger from ParseDeclaratorInternal to ActOnFunctionDeclarator
Part of: Late Parsing Refactoring for Bounds Safety Type Attributes (see llvm/llvm-project#179612) Phase: 0 (no dependencies, can be done immediately) Type: Downstream refactoring
Description
Currently, late parsing for function parameter bounds-safety attributes is triggered early during declarator parsing in ParseDeclaratorInternal. This is done to prevent FunctionDecl from being immediately merged with a previous declaration when the bounds attributes differ.
Move this trigger to ActOnFunctionDeclarator in SemaDecl.cpp, after the full FunctionDecl is created. The old late parsing mechanism stays — only the trigger location changes.
Why
The new approach creates LateParsedAttrType placeholders during declarator parsing and replaces them after the declaration is fully formed. Moving the trigger now validates that late parsing for parameters works from the new site, before the full mechanism switch.
Risk
Moving the trigger changes when late parsing occurs relative to other parser state. Scope setup for parameter name lookup must be replicated at the new site. Function redeclaration must be carefully verified.
Key files
clang/lib/Parse/ParseDecl.cpp— current trigger in ParseDeclaratorInternal at line 6806-6842clang/lib/Sema/SemaDecl.cpp— target location inActOnFunctionDeclarator
Validation
All existing lit tests must pass. Function redeclaration behavior must be verified.
Hi, I would like to work on this.
@abhijeetsharma200 Are you still working on it? Let me know if you have any questions.
Hi, just pushed a PR. Please take a look. Apologies for the delay
CC @Holo-xy