summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Sema/SemaExpr.cpp23
-rw-r--r--clang/test/Sema/typo-correction.c5
2 files changed, 17 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 5813a626b0f..2f3f4c55f10 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -4937,19 +4937,20 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
TheCall = new (Context) CallExpr(Context, Fn, Args, Context.BoolTy,
VK_RValue, RParenLoc);
+ if (!getLangOpts().CPlusPlus) {
+ // C cannot always handle TypoExpr nodes in builtin calls and direct
+ // function calls as their argument checking don't necessarily handle
+ // dependent types properly, so make sure any TypoExprs have been
+ // dealt with.
+ ExprResult Result = CorrectDelayedTyposInExpr(TheCall);
+ if (!Result.isUsable()) return ExprError();
+ TheCall = dyn_cast<CallExpr>(Result.get());
+ if (!TheCall) return Result;
+ }
+
// Bail out early if calling a builtin with custom typechecking.
- if (BuiltinID && Context.BuiltinInfo.hasCustomTypechecking(BuiltinID)) {
- if (!getLangOpts().CPlusPlus) {
- // C cannot handle TypoExpr nodes in the builtin's call expr because it
- // doesn't handle dependent types properly, so make sure any TypoExprs have
- // been dealt with.
- ExprResult Result = CorrectDelayedTyposInExpr(TheCall);
- if (!Result.isUsable()) return ExprError();
- TheCall = dyn_cast<CallExpr>(Result.get());
- if (!TheCall) return Result;
- }
+ if (BuiltinID && Context.BuiltinInfo.hasCustomTypechecking(BuiltinID))
return CheckBuiltinFunctionCall(FDecl, BuiltinID, TheCall);
- }
retry:
const FunctionType *FuncT;
diff --git a/clang/test/Sema/typo-correction.c b/clang/test/Sema/typo-correction.c
index 2f8d2b32ff8..ff43064d5b7 100644
--- a/clang/test/Sema/typo-correction.c
+++ b/clang/test/Sema/typo-correction.c
@@ -44,3 +44,8 @@ int PR23101(__m128i __x) {
void f(long *a, long b) {
__atomic_or_fetch(a, b, c); // expected-error {{use of undeclared identifier 'c'}}
}
+
+extern double cabs(_Complex double z);
+void fn1() {
+ cabs(errij); // expected-error {{use of undeclared identifier 'errij'}}
+}
OpenPOWER on IntegriCloud