r324308 - Fix crash on invalid.
Richard Trieu via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 21 16:15:11 PST 2018
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 at 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 <typename T> struct X {};
> +// expected-note at -1 {{template parameter is declared here}}
> +
> +template <typename T>
> +void Run(const int& points) {
> +// expected-note at -1 {{'points' declared here}}
> + auto outer_lambda = []() {
> + auto inner_lambda = [](const X<Points>&) {};
> + // expected-error at -1 {{use of undeclared identifier 'Points'; did
> you mean 'points'?}}
> + // expected-error at -2 {{template argument for template type parameter
> must be a type}}
> + };
> +}
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180221/af8a2026/attachment.html>
More information about the cfe-commits
mailing list