aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-17 19:32:54 +0000
committerChris Lattner <sabre@nondot.org>2009-04-17 19:32:54 +0000
commit23a48cc69e7ed4f219996a8864cb7d3f24f1157f (patch)
treec5eea0dc1af0bd6501d36a1a967e91d5c967836f /lib/Sema/SemaDecl.cpp
parent84af7c27cdc615ff917a501d61256b4049383c97 (diff)
fix a crash on invalid by making ActOnDeclarator create decl with
a dummy *function* type when it is recovering and knows it needs a function. rdar://6802350 - clang crash on invalid input git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69374 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 3b6ce6bd73..0fe5715578 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1327,6 +1327,9 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, bool IsFunctionDefinition) {
if (R.isNull()) {
InvalidDecl = true;
R = Context.IntTy;
+ if (IsFunctionDefinition) // int(...)
+ R = Context.getFunctionType(R, 0, 0, true, 0);
+
}
// See if this is a redefinition of a variable in the same scope.