aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/SemaType.cpp28
1 files changed, 10 insertions, 18 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 9206b1bed6..b6d28cbe71 100644
--- a/lib/Sema/SemaType.cpp
+++ b/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();