[clang] [BoundsSafety] unify ParseLexedAttribute (PR #186033)

Yeoul Na via cfe-commits cfe-commits at lists.llvm.org
Tue May 26 09:56:58 PDT 2026


================
@@ -725,83 +725,86 @@ void Parser::ParseLexedAttributes(ParsingClass &Class) {
 }
 
 void Parser::ParseLexedAttributeList(LateParsedAttrList &LAs, Decl *D,
-                                     bool EnterScope, bool OnDefinition) {
+                                     bool EnterScope, bool OnDefinition,
+                                     ParsedAttributes *OutAttrs) {
   assert(LAs.parseSoon() &&
          "Attribute list should be marked for immediate parsing.");
   for (unsigned i = 0, ni = LAs.size(); i < ni; ++i) {
     if (D)
       LAs[i]->addDecl(D);
-    ParseLexedAttribute(*LAs[i], EnterScope, OnDefinition);
+    ParseLexedAttribute(*LAs[i], EnterScope, OnDefinition, OutAttrs);
     delete LAs[i];
   }
   LAs.clear();
 }
 
-void Parser::ParseLexedAttribute(LateParsedAttribute &LA,
-                                 bool EnterScope, bool OnDefinition) {
+void Parser::ParseLexedAttribute(LateParsedAttribute &LPA, bool EnterScope,
+                                 bool OnDefinition,
+                                 ParsedAttributes *OutAttrs) {
   // Create a fake EOF so that attribute parsing won't go off the end of the
   // attribute.
   Token AttrEnd;
----------------
rapidsna wrote:

You may want to take a look at https://github.com/swiftlang/llvm-project/pull/12953/changes, which introduces ParseLexedCAttributeTokens to avoid duplication. In the current PR, this code is still duplicated here and in ParseLexedCAttributeTokens. To reflect this refactoring, we should create a unified ParseLexedAttributeTokens.

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


More information about the cfe-commits mailing list