Re: r324308 - Fix crash on invalid.
Thanks, Hans! On Thu, Feb 22, 2018 at 3:27 AM, Hans Wennborg wrote: > Seems safe. Merged in r325766. > > On Thu, Feb 22, 2018 at 1:15 AM, Richard Trieu wrote: > > Hi Hans, > > > > If there's still time for rc3, I'd like to get this crash fix in. This > adds > > a null check to prevent a crash on invalid. > > > > Richard > > > > On Mon, Feb 5, 2018 at 6:58 PM, Richard Trieu via cfe-commits > > wrote: > >> > >> Author: rtrieu > >> Date: Mon Feb 5 18:58:21 2018 > >> New Revision: 324308 > >> > >> URL: http://llvm.org/viewvc/llvm-project?rev=324308&view=rev > >> Log: > >> Fix crash on invalid. > >> > >> Don't call a method when the pointer is null. > >> > >> Modified: > >> cfe/trunk/lib/Sema/SemaExpr.cpp > >> cfe/trunk/test/SemaCXX/lambda-expressions.cpp > >> > >> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp > >> URL: > >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/ > SemaExpr.cpp?rev=324308&r1=324307&r2=324308&view=diff > >> > >> > == > >> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) > >> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Feb 5 18:58:21 2018 > >> @@ -14958,7 +14958,8 @@ static void DoMarkVarDeclReferenced(Sema > >> if (RefersToEnclosingScope) { > >>LambdaScopeInfo *const LSI = > >>SemaRef.getCurLambda(/*IgnoreNonLambdaCapturingScope= > */true); > >> - if (LSI && !LSI->CallOperator->Encloses(Var->getDeclContext())) > { > >> + if (LSI && (!LSI->CallOperator || > >> + !LSI->CallOperator->Encloses(Var->getDeclContext( > { > >> // If a variable could potentially be odr-used, defer marking > it > >> so > >> // until we finish analyzing the full expression for any > >> // lvalue-to-rvalue > >> > >> Modified: cfe/trunk/test/SemaCXX/lambda-expressions.cpp > >> URL: > >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ > SemaCXX/lambda-expressions.cpp?rev=324308&r1=324307&r2=324308&view=diff > >> > >> > == > >> --- cfe/trunk/test/SemaCXX/lambda-expressions.cpp (original) > >> +++ cfe/trunk/test/SemaCXX/lambda-expressions.cpp Mon Feb 5 18:58:21 > 2018 > >> @@ -608,3 +608,18 @@ namespace ConversionOperatorDoesNotHaveD > >>// This used to crash in return type deduction for the conversion > >> opreator. > >>struct A { int n; void f() { +[](decltype(n)) {}; } }; > >> } > >> + > >> +namespace TypoCorrection { > >> +template struct X {}; > >> +// expected-note@-1 {{template parameter is declared here}} > >> + > >> +template > >> +void Run(const int& points) { > >> +// expected-note@-1 {{'points' declared here}} > >> + auto outer_lambda = []() { > >> +auto inner_lambda = [](const X&) {}; > >> +// expected-error@-1 {{use of undeclared identifier 'Points'; did > you > >> mean 'points'?}} > >> +// expected-error@-2 {{template argument for template type > parameter > >> must be a type}} > >> + }; > >> +} > >> +} > >> > >> > >> ___ > >> cfe-commits mailing list > >> cfe-commits@lists.llvm.org > >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > > > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r324308 - Fix crash on invalid.
Seems safe. Merged in r325766. On Thu, Feb 22, 2018 at 1:15 AM, Richard Trieu wrote: > Hi Hans, > > If there's still time for rc3, I'd like to get this crash fix in. This adds > a null check to prevent a crash on invalid. > > Richard > > On Mon, Feb 5, 2018 at 6:58 PM, Richard Trieu via cfe-commits > wrote: >> >> Author: rtrieu >> Date: Mon Feb 5 18:58:21 2018 >> New Revision: 324308 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=324308&view=rev >> Log: >> Fix crash on invalid. >> >> Don't call a method when the pointer is null. >> >> Modified: >> cfe/trunk/lib/Sema/SemaExpr.cpp >> cfe/trunk/test/SemaCXX/lambda-expressions.cpp >> >> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=324308&r1=324307&r2=324308&view=diff >> >> == >> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) >> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Feb 5 18:58:21 2018 >> @@ -14958,7 +14958,8 @@ static void DoMarkVarDeclReferenced(Sema >> if (RefersToEnclosingScope) { >>LambdaScopeInfo *const LSI = >>SemaRef.getCurLambda(/*IgnoreNonLambdaCapturingScope=*/true); >> - if (LSI && !LSI->CallOperator->Encloses(Var->getDeclContext())) { >> + if (LSI && (!LSI->CallOperator || >> + !LSI->CallOperator->Encloses(Var->getDeclContext( { >> // If a variable could potentially be odr-used, defer marking it >> so >> // until we finish analyzing the full expression for any >> // lvalue-to-rvalue >> >> Modified: cfe/trunk/test/SemaCXX/lambda-expressions.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/lambda-expressions.cpp?rev=324308&r1=324307&r2=324308&view=diff >> >> == >> --- cfe/trunk/test/SemaCXX/lambda-expressions.cpp (original) >> +++ cfe/trunk/test/SemaCXX/lambda-expressions.cpp Mon Feb 5 18:58:21 2018 >> @@ -608,3 +608,18 @@ namespace ConversionOperatorDoesNotHaveD >>// This used to crash in return type deduction for the conversion >> opreator. >>struct A { int n; void f() { +[](decltype(n)) {}; } }; >> } >> + >> +namespace TypoCorrection { >> +template struct X {}; >> +// expected-note@-1 {{template parameter is declared here}} >> + >> +template >> +void Run(const int& points) { >> +// expected-note@-1 {{'points' declared here}} >> + auto outer_lambda = []() { >> +auto inner_lambda = [](const X&) {}; >> +// expected-error@-1 {{use of undeclared identifier 'Points'; did you >> mean 'points'?}} >> +// expected-error@-2 {{template argument for template type parameter >> must be a type}} >> + }; >> +} >> +} >> >> >> ___ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r324308 - Fix crash on invalid.
Hi Hans, If there's still time for rc3, I'd like to get this crash fix in. This adds a null check to prevent a crash on invalid. Richard On Mon, Feb 5, 2018 at 6:58 PM, Richard Trieu via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: rtrieu > Date: Mon Feb 5 18:58:21 2018 > New Revision: 324308 > > URL: http://llvm.org/viewvc/llvm-project?rev=324308&view=rev > Log: > Fix crash on invalid. > > Don't call a method when the pointer is null. > > Modified: > cfe/trunk/lib/Sema/SemaExpr.cpp > cfe/trunk/test/SemaCXX/lambda-expressions.cpp > > Modified: cfe/trunk/lib/Sema/SemaExpr.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaE > xpr.cpp?rev=324308&r1=324307&r2=324308&view=diff > > == > --- cfe/trunk/lib/Sema/SemaExpr.cpp (original) > +++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Feb 5 18:58:21 2018 > @@ -14958,7 +14958,8 @@ static void DoMarkVarDeclReferenced(Sema > if (RefersToEnclosingScope) { >LambdaScopeInfo *const LSI = >SemaRef.getCurLambda(/*IgnoreNonLambdaCapturingScope=*/true); > - if (LSI && !LSI->CallOperator->Encloses(Var->getDeclContext())) { > + if (LSI && (!LSI->CallOperator || > + !LSI->CallOperator->Encloses(Var->getDeclContext( { > // If a variable could potentially be odr-used, defer marking it > so > // until we finish analyzing the full expression for any > // lvalue-to-rvalue > > Modified: cfe/trunk/test/SemaCXX/lambda-expressions.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/ > lambda-expressions.cpp?rev=324308&r1=324307&r2=324308&view=diff > > == > --- cfe/trunk/test/SemaCXX/lambda-expressions.cpp (original) > +++ cfe/trunk/test/SemaCXX/lambda-expressions.cpp Mon Feb 5 18:58:21 2018 > @@ -608,3 +608,18 @@ namespace ConversionOperatorDoesNotHaveD >// This used to crash in return type deduction for the conversion > opreator. >struct A { int n; void f() { +[](decltype(n)) {}; } }; > } > + > +namespace TypoCorrection { > +template struct X {}; > +// expected-note@-1 {{template parameter is declared here}} > + > +template > +void Run(const int& points) { > +// expected-note@-1 {{'points' declared here}} > + auto outer_lambda = []() { > +auto inner_lambda = [](const X&) {}; > +// expected-error@-1 {{use of undeclared identifier 'Points'; did > you mean 'points'?}} > +// expected-error@-2 {{template argument for template type parameter > must be a type}} > + }; > +} > +} > > > ___ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits > ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits