]> granicus.if.org Git - clang/commitdiff
Merging r245560:
authorHans Wennborg <hans@hanshq.net>
Thu, 20 Aug 2015 21:09:20 +0000 (21:09 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 20 Aug 2015 21:09:20 +0000 (21:09 +0000)
------------------------------------------------------------------------
r245560 | ogoffart | 2015-08-20 06:11:14 -0700 (Thu, 20 Aug 2015) | 5 lines

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
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_37@245615 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/Sema/typo-correction.c

index 617b06af16b4c93c26fc2430eefc5a19eee39c22..6499cb5d19ebdd38da8401f3e97395764b67cddb 100644 (file)
@@ -4949,6 +4949,7 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
     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.
index ff43064d5b757ace96bc462a818060c2966964f3..4ef50570899c2dfa244f6f55684290702dc27bae 100644 (file)
@@ -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'?}}
+}