[cfe-commits] r69374 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/function.c
Chris Lattner
sabre at nondot.org
Fri Apr 17 12:32:55 PDT 2009
Author: lattner
Date: Fri Apr 17 14:32:54 2009
New Revision: 69374
URL: http://llvm.org/viewvc/llvm-project?rev=69374&view=rev
Log:
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
Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/function.c
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=69374&r1=69373&r2=69374&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Apr 17 14:32:54 2009
@@ -1327,6 +1327,9 @@
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.
Modified: cfe/trunk/test/Sema/function.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/function.c?rev=69374&r1=69373&r2=69374&view=diff
==============================================================================
--- cfe/trunk/test/Sema/function.c (original)
+++ cfe/trunk/test/Sema/function.c Fri Apr 17 14:32:54 2009
@@ -70,3 +70,10 @@
void
__attribute__((__gnuc_inline__)) // expected-warning {{'gnuc_inline' attribute requires function to be marked 'inline', attribute ignored}} expected-warning{{extension used}}
gnu_inline2() {}
+
+
+// rdar://6802350
+inline foo_t invalid_type() { // expected-error {{unknown type name 'foo_t'}}
+}
+
+
More information about the cfe-commits
mailing list