aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-26 01:53:50 +0000
committerChris Lattner <sabre@nondot.org>2008-07-26 01:53:50 +0000
commitae4da6150bb837311a2f0f958b01a2989066ba90 (patch)
treecb1c8b4c5f85fbef9f31e2b2a4942f56f68ff8c6 /lib/Parse/ParseDecl.cpp
parent3bd934a624660db940612ca3c5dfd7128ede79e5 (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/Parse/ParseDecl.cpp')
-rw-r--r--lib/Parse/ParseDecl.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/Parse/ParseDecl.cpp b/lib/Parse/ParseDecl.cpp
index 98c2d897d5..5ed1a61769 100644
--- a/lib/Parse/ParseDecl.cpp
+++ b/lib/Parse/ParseDecl.cpp
@@ -435,12 +435,11 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) {
ParseObjCProtocolReferences(ProtocolRefs, EndProtoLoc);
// FIXME: New'ing this here seems wrong, why not have the action do it?
- llvm::SmallVector<DeclTy *, 8> *ProtocolDecl =
- new llvm::SmallVector<DeclTy *, 8>;
- DS.setProtocolQualifiers(ProtocolDecl);
+ llvm::SmallVector<DeclTy *, 8> ProtocolDecl;
Actions.FindProtocolDeclaration(Loc,
&ProtocolRefs[0], ProtocolRefs.size(),
- *ProtocolDecl);
+ ProtocolDecl);
+ DS.setProtocolQualifiers(&ProtocolDecl[0], ProtocolDecl.size());
DS.SetRangeEnd(EndProtoLoc);
@@ -576,12 +575,11 @@ void Parser::ParseDeclarationSpecifiers(DeclSpec &DS) {
SourceLocation EndProtoLoc;
llvm::SmallVector<IdentifierLocPair, 8> ProtocolRefs;
ParseObjCProtocolReferences(ProtocolRefs, EndProtoLoc);
- llvm::SmallVector<DeclTy *, 8> *ProtocolDecl =
- new llvm::SmallVector<DeclTy *, 8>;
- DS.setProtocolQualifiers(ProtocolDecl);
+ llvm::SmallVector<DeclTy *, 8> ProtocolDecl;
Actions.FindProtocolDeclaration(Loc,
&ProtocolRefs[0], ProtocolRefs.size(),
- *ProtocolDecl);
+ ProtocolDecl);
+ DS.setProtocolQualifiers(&ProtocolDecl[0], ProtocolDecl.size());
DS.SetRangeEnd(EndProtoLoc);
Diag(Loc, diag::warn_objc_protocol_qualifier_missing_id,