diff options
author | John McCall <rjmccall@apple.com> | 2011-03-23 23:43:04 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-03-23 23:43:04 +0000 |
commit | c23308ceea7597b9020a821996325930be2fdbf6 (patch) | |
tree | f88e08d33143511cc01930ed37607ee50a98b4e8 /clang/lib | |
parent | 67d3d915cc8b7f786c5a882d460847e6e49cbf7a (diff) | |
download | bcm5719-llvm-c23308ceea7597b9020a821996325930be2fdbf6.tar.gz bcm5719-llvm-c23308ceea7597b9020a821996325930be2fdbf6.zip |
Call out ObjC parameter types as a different kind of declarator context
from a normal type-spec, just for completeness.
llvm-svn: 128185
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 2 | ||||
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index d4391ee3e93..dab63548a45 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -776,7 +776,7 @@ ParsedType Parser::ParseObjCTypeName(ObjCDeclSpec &DS, ParsedType Ty; if (isTypeSpecifierQualifier()) { - TypeResult TypeSpec = ParseTypeName(); + TypeResult TypeSpec = ParseTypeName(0, Declarator::ObjCPrototypeContext); if (!TypeSpec.isInvalid()) Ty = TypeSpec.get(); } diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 88541c9508e..b3cdbb27253 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -1550,6 +1550,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S, case Declarator::KNRTypeListContext: assert(0 && "K&R type lists aren't allowed in C++"); break; + case Declarator::ObjCPrototypeContext: case Declarator::PrototypeContext: Error = 0; // Function prototype break; @@ -1698,8 +1699,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S, ASM = ArrayType::Static; else ASM = ArrayType::Normal; - if (ASM == ArrayType::Star && - D.getContext() != Declarator::PrototypeContext) { + if (ASM == ArrayType::Star && !D.isPrototypeContext()) { // FIXME: This check isn't quite right: it allows star in prototypes // for function definitions, and disallows some edge cases detailed // in http://gcc.gnu.org/ml/gcc-patches/2009-02/msg00133.html @@ -2168,6 +2168,7 @@ TypeSourceInfo *Sema::GetTypeForDeclarator(Declarator &D, Scope *S, case Declarator::FileContext: case Declarator::KNRTypeListContext: + case Declarator::ObjCPrototypeContext: // FIXME: special diagnostic here? case Declarator::TypeNameContext: case Declarator::MemberContext: case Declarator::BlockContext: |