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@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to