diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-26 00:46:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-26 00:46:50 +0000 |
commit | 62f5f7ffad57e0c2af2b308af3735351505937cb (patch) | |
tree | 353240f7c128b8820c20b8137281f6ebce1d542d /lib/Sema/SemaType.cpp | |
parent | bce6135441fd489527a9ad1776d0472335be596d (diff) |
fix several problems with the protocol qualified id handling where id was implicit.
First, fix canonical type handling of these, since protocol qualified id's are always
canonical. Next, enhance SemaType to actually make these when used (instead of int)
allowing them to actually be used when appropriate. Finally remove a bunch of logic
relating to the mishandling of canonical types with protocol-qual id's. This fixes
rdar://5986251
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54083 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 4bee2de994..85a457bd56 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -43,6 +43,14 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS) { } break; case DeclSpec::TST_unspecified: + // "<proto1,proto2>" is an objc qualified ID with a missing id. + if (llvm::SmallVector<Action::DeclTy *, 8> *PQ=DS.getProtocolQualifiers()) { + Action::DeclTy **PPDecl = &(*PQ)[0]; + Result = Context.getObjCQualifiedIdType((ObjCProtocolDecl**)(PPDecl), + DS.getNumProtocolQualifiers()); + break; + } + // Unspecified typespec defaults to int in C90. However, the C90 grammar // [C90 6.5] only allows a decl-spec if there was *some* type-specifier, // type-qualifier, or storage-class-specifier. If not, emit an extwarn. @@ -128,13 +136,12 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS) { reinterpret_cast<ObjCProtocolDecl**>(PPDecl), DS.getNumProtocolQualifiers()); break; - } - else if (TypedefDecl *typeDecl = dyn_cast<TypedefDecl>(D)) { + } else if (TypedefDecl *typeDecl = dyn_cast<TypedefDecl>(D)) { if (Context.getObjCIdType() == Context.getTypedefType(typeDecl) && DS.getProtocolQualifiers()) { // id<protocol-list> Action::DeclTy **PPDecl = &(*DS.getProtocolQualifiers())[0]; - Result = Context.getObjCQualifiedIdType(typeDecl->getUnderlyingType(), + Result = Context.getObjCQualifiedIdType( reinterpret_cast<ObjCProtocolDecl**>(PPDecl), DS.getNumProtocolQualifiers()); break; |