return;
} else if (auto *OCE = dyn_cast<CXXOperatorCallExpr>(Call)) {
FunctionDecl *Callee = OCE->getDirectCallee();
- if (Callee && Callee->isCXXInstanceMember() &&
+ if (Callee->isCXXInstanceMember() &&
shouldTrackImplicitObjectArg(cast<CXXMethodDecl>(Callee)))
VisitPointerArg(Callee, OCE->getArg(0));
return;
// supporting lifetime extension.
break;
- case IndirectLocalPathEntry::VarInit:
- if (cast<VarDecl>(Path[I].D)->isImplicit())
- return SourceRange();
- LLVM_FALLTHROUGH;
case IndirectLocalPathEntry::DefaultInit:
+ case IndirectLocalPathEntry::VarInit:
return Path[I].E->getSourceRange();
}
}
return false;
}
- if (IsGslPtrInitWithGslTempOwner && DiagLoc.isValid()) {
+ if (IsGslPtrInitWithGslTempOwner) {
Diag(DiagLoc, diag::warn_dangling_lifetime_pointer) << DiagRange;
return false;
}
std::vector<int> getTempVec();
std::optional<std::vector<int>> getTempOptVec();
-void testLoops() {
- for (auto i : getTempVec()) // ok
- ;
- for (auto i : *getTempOptVec()) // expected-warning {{object backing the pointer will be destroyed at the end of the full-expression}}
- ;
-}
-
int &usedToBeFalsePositive(std::vector<int> &v) {
std::vector<int>::iterator it = v.begin();
int& value = *it;