r368462 - Revert Fix a build bot failure and multiple warnings instances for range base for loops
Gabor Horvath via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 9 11:58:09 PDT 2019
Author: xazax
Date: Fri Aug 9 11:58:09 2019
New Revision: 368462
URL: http://llvm.org/viewvc/llvm-project?rev=368462&view=rev
Log:
Revert Fix a build bot failure and multiple warnings instances for range base for loops
This reverts r368459 (git commit 2bf522aea62e4fb653cacb68072167d25149099e)
Modified:
cfe/trunk/lib/Sema/SemaInit.cpp
cfe/trunk/test/Sema/warn-lifetime-analysis-nocfg.cpp
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=368462&r1=368461&r2=368462&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Aug 9 11:58:09 2019
@@ -6616,7 +6616,7 @@ static void handleGslAnnotatedTypes(Indi
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;
@@ -7070,11 +7070,8 @@ static SourceRange nextPathEntryRange(co
// 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();
}
}
@@ -7136,7 +7133,7 @@ void Sema::checkInitializerLifetime(cons
return false;
}
- if (IsGslPtrInitWithGslTempOwner && DiagLoc.isValid()) {
+ if (IsGslPtrInitWithGslTempOwner) {
Diag(DiagLoc, diag::warn_dangling_lifetime_pointer) << DiagRange;
return false;
}
Modified: cfe/trunk/test/Sema/warn-lifetime-analysis-nocfg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-lifetime-analysis-nocfg.cpp?rev=368462&r1=368461&r2=368462&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-lifetime-analysis-nocfg.cpp (original)
+++ cfe/trunk/test/Sema/warn-lifetime-analysis-nocfg.cpp Fri Aug 9 11:58:09 2019
@@ -201,13 +201,6 @@ void danglingReferenceFromTempOwner() {
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;
More information about the cfe-commits
mailing list