r245560 - Fix crash with two typos in the arguments of a function

Hans Wennborg via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 20 14:10:28 PDT 2015


Merged in r245615.

Thanks,
Hans

On Thu, Aug 20, 2015 at 12:13 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> LGTM for branch.
>
> On Aug 20, 2015 9:47 AM, "Hans Wennborg" <hans at chromium.org> wrote:
>>
>> It was requested that this be merged to 3.7.
>>
>> Richard: OK for merging?
>>
>> Thanks,
>> Hans
>>
>> On Thu, Aug 20, 2015 at 6:11 AM, Olivier Goffart via cfe-commits
>> <cfe-commits at lists.llvm.org> wrote:
>> > Author: ogoffart
>> > Date: Thu Aug 20 08:11:14 2015
>> > New Revision: 245560
>> >
>> > URL: http://llvm.org/viewvc/llvm-project?rev=245560&view=rev
>> > Log:
>> > Fix crash with two typos in the arguments of a function
>> >
>> > The problem is that the arguments are of TheCall are reset later
>> > to the ones in Args, making TypoExpr put back. Some TypoExpr that have
>> > already  been diagnosed and will assert later in Sema::getTypoExprState
>> >
>> > Modified:
>> >     cfe/trunk/lib/Sema/SemaExpr.cpp
>> >     cfe/trunk/test/Sema/typo-correction.c
>> >
>> > Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=245560&r1=245559&r2=245560&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
>> > +++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Aug 20 08:11:14 2015
>> > @@ -4937,6 +4937,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
>> >      if (!Result.isUsable()) return ExprError();
>> >      TheCall = dyn_cast<CallExpr>(Result.get());
>> >      if (!TheCall) return Result;
>> > +    Args = ArrayRef<Expr *>(TheCall->getArgs(), TheCall->getNumArgs());
>> >    }
>> >
>> >    // Bail out early if calling a builtin with custom typechecking.
>> >
>> > Modified: cfe/trunk/test/Sema/typo-correction.c
>> > URL:
>> > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/typo-correction.c?rev=245560&r1=245559&r2=245560&view=diff
>> >
>> > ==============================================================================
>> > --- cfe/trunk/test/Sema/typo-correction.c (original)
>> > +++ cfe/trunk/test/Sema/typo-correction.c Thu Aug 20 08:11:14 2015
>> > @@ -49,3 +49,9 @@ extern double cabs(_Complex double z);
>> >  void fn1() {
>> >    cabs(errij);  // expected-error {{use of undeclared identifier
>> > 'errij'}}
>> >  }
>> > +
>> > +extern long afunction(int); // expected-note {{'afunction' declared
>> > here}}
>> > +void fn2() {
>> > +  f(THIS_IS_AN_ERROR, // expected-error {{use of undeclared identifier
>> > 'THIS_IS_AN_ERROR'}}
>> > +    afunction(afunction_));  // expected-error {{use of undeclared
>> > identifier 'afunction_'; did you mean 'afunction'?}}
>> > +}
>> >
>> >
>> > _______________________________________________
>> > cfe-commits mailing list
>> > cfe-commits at lists.llvm.org
>> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list