[clang] [BoundsSafety][NFC] Add the count-refill logic for late-parsed bounds attributes (PR #224556)
Yeoul Na via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 18 11:03:23 PDT 2026
================
@@ -4896,6 +4896,54 @@ void Parser::ParseLexedTypeAttribute(LateParsedTypeAttribute &LA,
OutAttrs.takeAllAppendingFrom(Attrs);
}
+void Parser::CompleteLateParsedTypeAttributes(
+ SmallVectorImpl<LateParsedTypeAttribute *> &LateTypeAttrs) {
+ for (LateParsedTypeAttribute *LTA : LateTypeAttrs) {
+ // Read these out before parsing, which destroys the attribute. The type is
+ // null if construction rejected the attribute, in which case the diagnostic
+ // has already been emitted and there is nothing to complete.
+ BoundsAttributedType *BATy = LTA->TypeToComplete;
+ // Rejected during construction (already diagnosed); the cached tokens are
+ // self-contained, so there is nothing to drain — just discard it.
+ if (!BATy) {
+ delete LTA;
----------------
rapidsna wrote:
I used `unique_ptr` and removed raw `delete`s in this function for the sake of this PR. Will file a separate issue to track the ownership issue for the whole LateParsedDeclaration family.
https://github.com/llvm/llvm-project/pull/224556
More information about the cfe-commits
mailing list