r368459 - Fix a build bot failure and multiple warnings instances for range base for loops
Jonas Devlieghere via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 9 11:31:53 PDT 2019
I think this is causing a stage2 failure:
http://green.lab.llvm.org/green/view/LLDB/job/lldb-cmake/124/consoleFull#-95886206949ba4694-19c4-4d7e-bec5-911270d8a58c
On Fri, Aug 9, 2019 at 10:41 AM Gabor Horvath via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
>
> Author: xazax
> Date: Fri Aug 9 10:42:41 2019
> New Revision: 368459
>
> URL: http://llvm.org/viewvc/llvm-project?rev=368459&view=rev
> Log:
> Fix a build bot failure and multiple warnings instances for range base for loops
>
> 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=368459&r1=368458&r2=368459&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaInit.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaInit.cpp Fri Aug 9 10:42:41 2019
> @@ -6616,7 +6616,7 @@ static void handleGslAnnotatedTypes(Indi
> return;
> } else if (auto *OCE = dyn_cast<CXXOperatorCallExpr>(Call)) {
> FunctionDecl *Callee = OCE->getDirectCallee();
> - if (Callee->isCXXInstanceMember() &&
> + if (Callee && Callee->isCXXInstanceMember() &&
> shouldTrackImplicitObjectArg(cast<CXXMethodDecl>(Callee)))
> VisitPointerArg(Callee, OCE->getArg(0));
> return;
> @@ -7070,8 +7070,11 @@ static SourceRange nextPathEntryRange(co
> // supporting lifetime extension.
> break;
>
> - case IndirectLocalPathEntry::DefaultInit:
> case IndirectLocalPathEntry::VarInit:
> + if (cast<VarDecl>(Path[I].D)->isImplicit())
> + return SourceRange();
> + LLVM_FALLTHROUGH;
> + case IndirectLocalPathEntry::DefaultInit:
> return Path[I].E->getSourceRange();
> }
> }
> @@ -7133,7 +7136,7 @@ void Sema::checkInitializerLifetime(cons
> return false;
> }
>
> - if (IsGslPtrInitWithGslTempOwner) {
> + if (IsGslPtrInitWithGslTempOwner && DiagLoc.isValid()) {
> 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=368459&r1=368458&r2=368459&view=diff
> ==============================================================================
> --- cfe/trunk/test/Sema/warn-lifetime-analysis-nocfg.cpp (original)
> +++ cfe/trunk/test/Sema/warn-lifetime-analysis-nocfg.cpp Fri Aug 9 10:42:41 2019
> @@ -201,6 +201,13 @@ 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;
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list