diff options
author | John McCall <rjmccall@apple.com> | 2011-02-08 01:59:10 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-02-08 01:59:10 +0000 |
commit | 653dac4b0af927a2d0797de938abc8ad2a8164e4 (patch) | |
tree | 67959d122d12ed6f43b056ed1adbaaa06f02bd21 | |
parent | 2da6d495236931a07a79b605821210d096fe6f30 (diff) | |
download | bcm5719-llvm-653dac4b0af927a2d0797de938abc8ad2a8164e4.tar.gz bcm5719-llvm-653dac4b0af927a2d0797de938abc8ad2a8164e4.zip |
dgregor accidentally killed this assert, but on investigation, it can fire
on invalid code and we don't really care, so kill it harder.
llvm-svn: 125068
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 28 | ||||
-rw-r--r-- | clang/test/Sema/block-args.c | 6 |
2 files changed, 16 insertions, 18 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 9206b1bed6e..b6d28cbe719 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -486,27 +486,19 @@ static void maybeSynthesizeBlockSignature(TypeProcessingState &state, return; } - // If there are any type objects, the type as written won't - // name a function, regardless of the decl spec type. This - // is because a block signature declarator is always an - // abstract-declarator, and abstract-declarators can't just - // be parentheses chunks. Therefore we need to build a function - // chunk unless there are no type objects and the decl spec - // type is a function. + // If there are any type objects, the type as written won't name a + // function, regardless of the decl spec type. This is because a + // block signature declarator is always an abstract-declarator, and + // abstract-declarators can't just be parentheses chunks. Therefore + // we need to build a function chunk unless there are no type + // objects and the decl spec type is a function. if (!declarator.getNumTypeObjects() && declSpecType->isFunctionType()) return; -#ifndef NDEBUG - if (declarator.getNumTypeObjects()) { - bool isOnlyParens = true; - for (unsigned i = 0, e = declarator.getNumTypeObjects(); i != e; ++i) { - if (declarator.getTypeObject(i).Kind != DeclaratorChunk::Paren) { - isOnlyParens = false; - break; - } - } - } -#endif + // Note that there *are* cases with invalid declarators where + // declarators consist solely of parentheses. In general, these + // occur only in failed efforts to make function declarators, so + // faking up the function chunk is still the right thing to do. // Otherwise, we need to fake up a function declarator. SourceLocation loc = declarator.getSourceRange().getBegin(); diff --git a/clang/test/Sema/block-args.c b/clang/test/Sema/block-args.c index 970c60d51dd..e2e2d8e4462 100644 --- a/clang/test/Sema/block-args.c +++ b/clang/test/Sema/block-args.c @@ -34,3 +34,9 @@ void f0() { ^(int, double d, char) {}(1, 1.34, 'a'); // expected-error {{parameter name omitted}} \ // expected-error {{parameter name omitted}} } + +// rdar://problem/8962770 +void test4() { + int (^f)() = ^((x)) { }; // expected-error {{expected ')'}} expected-warning {{type specifier missing}} expected-note {{to match this}} +} + |