]> granicus.if.org Git - clang/commitdiff
Revert Fix a build bot failure and multiple warnings instances for range base for...
authorGabor Horvath <xazax.hun@gmail.com>
Fri, 9 Aug 2019 18:58:09 +0000 (18:58 +0000)
committerGabor Horvath <xazax.hun@gmail.com>
Fri, 9 Aug 2019 18:58:09 +0000 (18:58 +0000)
This reverts r368459 (git commit 2bf522aea62e4fb653cacb68072167d25149099e)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368462 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaInit.cpp
test/Sema/warn-lifetime-analysis-nocfg.cpp

index 3ac45e25bb274b6287de9f858b7063b3d89934a1..dfc12e91a654dad2df58ef435be94a0b36bf1c46 100644 (file)
@@ -6616,7 +6616,7 @@ static void handleGslAnnotatedTypes(IndirectLocalPath &Path, Expr *Call,
     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(const IndirectLocalPath &Path, unsigned I,
       // 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(const InitializedEntity &Entity,
         return false;
       }
 
-      if (IsGslPtrInitWithGslTempOwner && DiagLoc.isValid()) {
+      if (IsGslPtrInitWithGslTempOwner) {
         Diag(DiagLoc, diag::warn_dangling_lifetime_pointer) << DiagRange;
         return false;
       }
index eaddb74e5a3c3e5025389cfd67ae122597357528..efa54fe662b8821b1196f49a81a0ac9edf0e102b 100644 (file)
@@ -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;