https://github.com/rapidsna created https://github.com/llvm/llvm-project/pull/102076
…heckCountedByAttrOnField' llvm::SmallVectorImpl<TypeCoupledDeclRefInfo> &Decls is a vector of declarations referred to by the argument of 'counted_by' attributes and frields. Since 'BuildCountAttributedArrayOrPointerType' has been made self-contained to produce the 'Decls' within itself to allow 'TreeTransform' to invoke the functinon without having to call 'Sema::CheckCountedByAttrOnField' again. >From 31ebb67f8f29ee22ee018836b9f023ff69a9ee80 Mon Sep 17 00:00:00 2001 From: Yeoul Na <yeoul...@apple.com> Date: Mon, 5 Aug 2024 15:37:35 -0700 Subject: [PATCH] [BoundsSafety][NFC] Remove the unused parameter 'Decls' from 'Sema::CheckCountedByAttrOnField' llvm::SmallVectorImpl<TypeCoupledDeclRefInfo> &Decls is a vector of declarations referred to by the argument of 'counted_by' attributes and frields. Since 'BuildCountAttributedArrayOrPointerType' has been made self-contained to produce the 'Decls' within itself to allow 'TreeTransform' to invoke the functinon without having to call 'Sema::CheckCountedByAttrOnField' again. --- clang/include/clang/Sema/Sema.h | 6 ++---- clang/lib/Sema/SemaBoundsSafety.cpp | 8 ++------ clang/lib/Sema/SemaDeclAttr.cpp | 3 +-- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index 2ec6367eccea0..d00b3511059f7 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -15086,10 +15086,8 @@ class Sema final : public SemaBase { /// `counted_by_or_null` attribute. /// /// \returns false iff semantically valid. - bool CheckCountedByAttrOnField( - FieldDecl *FD, Expr *E, - llvm::SmallVectorImpl<TypeCoupledDeclRefInfo> &Decls, bool CountInBytes, - bool OrNull); + bool CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes, + bool OrNull); ///@} }; diff --git a/clang/lib/Sema/SemaBoundsSafety.cpp b/clang/lib/Sema/SemaBoundsSafety.cpp index 290c820938898..d63a2389ea11d 100644 --- a/clang/lib/Sema/SemaBoundsSafety.cpp +++ b/clang/lib/Sema/SemaBoundsSafety.cpp @@ -48,10 +48,8 @@ enum class CountedByInvalidPointeeTypeKind { VALID, }; -bool Sema::CheckCountedByAttrOnField( - FieldDecl *FD, Expr *E, - llvm::SmallVectorImpl<TypeCoupledDeclRefInfo> &Decls, bool CountInBytes, - bool OrNull) { +bool Sema::CheckCountedByAttrOnField(FieldDecl *FD, Expr *E, bool CountInBytes, + bool OrNull) { // Check the context the attribute is used in unsigned Kind = getCountAttrKind(CountInBytes, OrNull); @@ -185,8 +183,6 @@ bool Sema::CheckCountedByAttrOnField( return true; } } - - Decls.push_back(TypeCoupledDeclRefInfo(CountFD, /*IsDref*/ false)); return false; } diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp index 9011fa547638e..bcb1424825df0 100644 --- a/clang/lib/Sema/SemaDeclAttr.cpp +++ b/clang/lib/Sema/SemaDeclAttr.cpp @@ -5898,8 +5898,7 @@ static void handleCountedByAttrField(Sema &S, Decl *D, const ParsedAttr &AL) { llvm_unreachable("unexpected counted_by family attribute"); } - llvm::SmallVector<TypeCoupledDeclRefInfo, 1> Decls; - if (S.CheckCountedByAttrOnField(FD, CountExpr, Decls, CountInBytes, OrNull)) + if (S.CheckCountedByAttrOnField(FD, CountExpr, CountInBytes, OrNull)) return; QualType CAT = S.BuildCountAttributedArrayOrPointerType( _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits