diff --git a/clang/lib/Sema/CheckExprLifetime.cpp b/clang/lib/Sema/CheckExprLifetime.cpp index d9031256f235f8..5c8ef564f30aaf 100644 --- a/clang/lib/Sema/CheckExprLifetime.cpp +++ b/clang/lib/Sema/CheckExprLifetime.cpp @@ -308,8 +308,7 @@ static bool shouldTrackFirstArgument(const FunctionDecl *FD) { const auto *RD = FD->getParamDecl(0)->getType()->getPointeeCXXRecordDecl(); if (!FD->isInStdNamespace() || !RD || !RD->isInStdNamespace()) return false; - if (!isRecordWithAttr(QualType(RD->getTypeForDecl(), 0)) && - !isRecordWithAttr(QualType(RD->getTypeForDecl(), 0))) + if (!RD->hasAttr() && !RD->hasAttr()) return false; if (FD->getReturnType()->isPointerType() || isRecordWithAttr(FD->getReturnType())) {