Skip to content

Commit 90cdf04

Browse files
committed
Use helper function.
1 parent 8ab376a commit 90cdf04

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clang/lib/Sema/SemaDecl.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14692,11 +14692,10 @@ void Sema::FinalizeDeclaration(Decl *ThisDecl) {
1469214692

1469314693
// The result of __builtin_counted_by_ref cannot be assigned to a variable.
1469414694
// It allows leaking and modification of bounds safety information.
14695-
if (const auto *CE = dyn_cast_if_present<CallExpr>(VD->getInit());
14696-
CE && CE->getBuiltinCallee() == Builtin::BI__builtin_counted_by_ref)
14697-
Diag(CE->getExprLoc(),
14695+
if (IsBuiltinCountedByRef(VD->getInit()))
14696+
Diag(VD->getInit()->getExprLoc(),
1469814697
diag::err_builtin_counted_by_ref_cannot_leak_reference)
14699-
<< CE->getSourceRange();
14698+
<< VD->getInit()->getSourceRange();
1470014699

1470114700
checkAttributesAfterMerging(*this, *VD);
1470214701

0 commit comments

Comments
 (0)