diff options
author | Chris Lattner <sabre@nondot.org> | 2008-07-26 01:53:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-07-26 01:53:50 +0000 |
commit | ae4da6150bb837311a2f0f958b01a2989066ba90 (patch) | |
tree | cb1c8b4c5f85fbef9f31e2b2a4942f56f68ff8c6 /lib/Sema/SemaType.cpp | |
parent | 3bd934a624660db940612ca3c5dfd7128ede79e5 (diff) |
make DeclSpec manage its own protocol qualifier list memory instead of having
clients allocate the memory and it delete it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54087 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 85a457bd56..7acb4587a0 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -44,9 +44,8 @@ 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), + if (DeclSpec::ProtocolQualifierListTy PQ = DS.getProtocolQualifiers()) { + Result = Context.getObjCQualifiedIdType((ObjCProtocolDecl**)PQ, DS.getNumProtocolQualifiers()); break; } @@ -122,28 +121,25 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS) { assert(DS.getTypeSpecWidth() == 0 && DS.getTypeSpecComplex() == 0 && DS.getTypeSpecSign() == 0 && "Can't handle qualifiers on typedef names yet!"); + DeclSpec::ProtocolQualifierListTy PQ = DS.getProtocolQualifiers(); // FIXME: Adding a TST_objcInterface clause doesn't seem ideal, so // we have this "hack" for now... if (ObjCInterfaceDecl *ObjCIntDecl = dyn_cast<ObjCInterfaceDecl>(D)) { - if (DS.getProtocolQualifiers() == 0) { + if (PQ == 0) { Result = Context.getObjCInterfaceType(ObjCIntDecl); break; } - Action::DeclTy **PPDecl = &(*DS.getProtocolQualifiers())[0]; Result = Context.getObjCQualifiedInterfaceType(ObjCIntDecl, - reinterpret_cast<ObjCProtocolDecl**>(PPDecl), + (ObjCProtocolDecl**)PQ, DS.getNumProtocolQualifiers()); break; } 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( - reinterpret_cast<ObjCProtocolDecl**>(PPDecl), - DS.getNumProtocolQualifiers()); + if (Context.getObjCIdType() == Context.getTypedefType(typeDecl) && PQ) { + // id<protocol-list> + Result = Context.getObjCQualifiedIdType((ObjCProtocolDecl**)PQ, + DS.getNumProtocolQualifiers()); break; } } |