summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorKaelyn Takata <rikka@google.com>2015-06-23 18:42:21 +0000
committerKaelyn Takata <rikka@google.com>2015-06-23 18:42:21 +0000
commite53f0f9019429cd5ae21d61c431daf6b5cc76294 (patch)
tree9136f806d3c0ae370b8214120fc23d4f77ba6455 /clang/lib/Sema
parentdc975670c194e0078d684546d49d06c661f163f7 (diff)
downloadbcm5719-llvm-e53f0f9019429cd5ae21d61c431daf6b5cc76294.tar.gz
bcm5719-llvm-e53f0f9019429cd5ae21d61c431daf6b5cc76294.zip
Ensure delayed typos have been corrected in calls to builtins before
checking those calls when not in C++ mode, since those code paths can't handle dependent exprs. Fixes PR23740. llvm-svn: 240441
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 2d2cadab9a3..5813a626b0f 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -4938,8 +4938,18 @@ Sema::BuildResolvedCallExpr(Expr *Fn, NamedDecl *NDecl,
VK_RValue, RParenLoc);
// Bail out early if calling a builtin with custom typechecking.
- if (BuiltinID && Context.BuiltinInfo.hasCustomTypechecking(BuiltinID))
+ 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;
+ }
return CheckBuiltinFunctionCall(FDecl, BuiltinID, TheCall);
+ }
retry:
const FunctionType *FuncT;
OpenPOWER on IntegriCloud