diff options
author | Chris Lattner <sabre@nondot.org> | 2009-04-11 18:57:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-04-11 18:57:04 +0000 |
commit | d8626fd2837160636478137347136db920615926 (patch) | |
tree | 2cba1be3328563aac7362b1a889d1cbd5132cd69 /clang/lib/Parse/ParseObjc.cpp | |
parent | a4f6b6b180fb8f30127c6f2ff17dc1e4fe9f4136 (diff) | |
download | bcm5719-llvm-d8626fd2837160636478137347136db920615926.tar.gz bcm5719-llvm-d8626fd2837160636478137347136db920615926.zip |
change the interface to ActOnMethodDeclaration to pass down argument
information in a little struct instead of individually. While we're
at it, add per-argument loc info and attribute info.
llvm-svn: 68871
Diffstat (limited to 'clang/lib/Parse/ParseObjc.cpp')
-rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index 42ec8572513..239d35f8065 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -699,18 +699,15 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc, Selector Sel = PP.getSelectorTable().getNullarySelector(SelIdent); return Actions.ActOnMethodDeclaration(mLoc, Tok.getLocation(), mType, IDecl, DSRet, ReturnType, Sel, - 0, 0, 0, CargNames, + 0, CargNames, MethodAttrs, MethodImplKind); } llvm::SmallVector<IdentifierInfo *, 12> KeyIdents; - llvm::SmallVector<Action::TypeTy *, 12> KeyTypes; - llvm::SmallVector<ObjCDeclSpec, 12> ArgTypeQuals; - llvm::SmallVector<IdentifierInfo *, 12> ArgNames; + llvm::SmallVector<Action::ObjCArgInfo, 12> ArgInfos; - Action::TypeTy *TypeInfo; while (1) { - KeyIdents.push_back(SelIdent); + Action::ObjCArgInfo ArgInfo; // Each iteration parses a single keyword argument. if (Tok.isNot(tok::colon)) { @@ -718,25 +715,28 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc, break; } ConsumeToken(); // Eat the ':'. - ObjCDeclSpec DSType; - if (Tok.is(tok::l_paren)) // Parse the argument type. - TypeInfo = ParseObjCTypeName(DSType); - else - TypeInfo = 0; - KeyTypes.push_back(TypeInfo); - ArgTypeQuals.push_back(DSType); + ArgInfo.Type = 0; + if (Tok.is(tok::l_paren)) // Parse the argument type if present. + ArgInfo.Type = ParseObjCTypeName(ArgInfo.DeclSpec); + // If attributes exist before the argument name, parse them. + ArgInfo.ArgAttrs = 0; if (getLang().ObjC2 && Tok.is(tok::kw___attribute)) - ParseAttributes(); // FIXME: pass attributes through. + ArgInfo.ArgAttrs = ParseAttributes(); if (Tok.isNot(tok::identifier)) { Diag(Tok, diag::err_expected_ident); // missing argument name. break; } - ArgNames.push_back(Tok.getIdentifierInfo()); + + ArgInfo.Name = Tok.getIdentifierInfo(); + ArgInfo.NameLoc = Tok.getLocation(); ConsumeToken(); // Eat the identifier. + ArgInfos.push_back(ArgInfo); + KeyIdents.push_back(SelIdent); + // Check for another keyword selector. SourceLocation Loc; SelIdent = ParseObjCSelectorPiece(Loc); @@ -773,8 +773,7 @@ Parser::DeclPtrTy Parser::ParseObjCMethodDecl(SourceLocation mLoc, &KeyIdents[0]); return Actions.ActOnMethodDeclaration(mLoc, Tok.getLocation(), mType, IDecl, DSRet, ReturnType, Sel, - &ArgTypeQuals[0], &KeyTypes[0], - &ArgNames[0], CargNames, + &ArgInfos[0], CargNames, MethodAttrs, MethodImplKind, isVariadic); } |