[clang] [BoundsSafety][NFC] Hold LateParsedTypeAttrInfo in declarator late-attribute lists (PR #239050)

Dan Liew via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 5 14:03:10 PST 2026


================
@@ -1544,10 +1544,11 @@ class Parser : public CodeCompletionHandler {
                                    ArrayRef<const DeclRefExpr *> ParamRefs,
                                    bool ReenteredProtoParams);
 
-  /// Helper function to move LateParsedTypeAttribute pointers from one list
-  /// to another. Filters type attributes from \p From and appends them to \p
-  /// To.
-  static void TakeTypeAttrsAppendingFrom(LateParsedAttrList &To,
+  /// Moves the late-parsed type attributes out of \p From, appending a pointer
+  /// to each one's LateParsedTypeAttrInfo to \p To. \p To does not own the
+  /// LateParsedTypeAttribute objects: the caller must keep them alive while
+  /// \p To is in use (in a C record, CurRecordLateParsedTypeAttrs does).
+  static void TakeTypeAttrsAppendingFrom(LateParsedTypeAttrInfoList &To,
----------------
delcypher wrote:

This problem was there before but I've just realized this API looks odd. I feel like `From` should be first argument, not the second so that the API reads more naturally.

```
// Proposal: Appending from "From" reads naturally
TakeTypeAttrsAppendingFrom(From, To)

// Current: Parameter names seem backwards
TakeTypeAttrsAppendingFrom(To, From)
```

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


More information about the cfe-commits mailing list