Skip to content

Commit 5b1afd6

Browse files
hokeinyuxuanchen1997
authored andcommitted
[clang] NFC, simplify the code in CheckExprLifetime.cpp (#99637)
Summary: No need to get the Owner/Pointer attr via the type. The Decl has this attr information. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60251260
1 parent 3b9b235 commit 5b1afd6

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

clang/lib/Sema/CheckExprLifetime.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,7 @@ static bool shouldTrackFirstArgument(const FunctionDecl *FD) {
308308
const auto *RD = FD->getParamDecl(0)->getType()->getPointeeCXXRecordDecl();
309309
if (!FD->isInStdNamespace() || !RD || !RD->isInStdNamespace())
310310
return false;
311-
if (!isRecordWithAttr<PointerAttr>(QualType(RD->getTypeForDecl(), 0)) &&
312-
!isRecordWithAttr<OwnerAttr>(QualType(RD->getTypeForDecl(), 0)))
311+
if (!RD->hasAttr<PointerAttr>() && !RD->hasAttr<OwnerAttr>())
313312
return false;
314313
if (FD->getReturnType()->isPointerType() ||
315314
isRecordWithAttr<PointerAttr>(FD->getReturnType())) {

0 commit comments

Comments
 (0)