diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-12-21 17:34:17 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-12-21 17:34:17 +0000 |
commit | 87e927520df00373b3bef94040da3b62bbf45a39 (patch) | |
tree | d828cedadb9053faf0727044215e04886d609b3a /clang/lib/Parse/ParseObjc.cpp | |
parent | be57ab185f289c5a2e9f07e9a6ab6ca70bfbc5be (diff) | |
download | bcm5719-llvm-87e927520df00373b3bef94040da3b62bbf45a39.tar.gz bcm5719-llvm-87e927520df00373b3bef94040da3b62bbf45a39.zip |
Fix a major inconsistency in the representation of Objective-C
classes, categories, protocols, and class extensions, where the
methods and properties of these entities would be inserted into the
DeclContext in an ordering that doesn't necessarily reflect source
order. The culprits were Sema::ActOnMethodDeclaration(), which did not
perform the insertion of the just-created method declaration into
the DeclContext for these Objective-C entities, and
Sema::ActOnAtEnd(), which inserted all method declarations at the
*end* of the DeclContext.
With this fix in hand, clean up the code-completion actions for
property setters/getters that worked around this brokenness in the AST.
Fixes <rdar://problem/8062781>, where this problem manifested as poor
token-annotation information, but this would have struck again in many
other places.
llvm-svn: 122347
Diffstat (limited to 'clang/lib/Parse/ParseObjc.cpp')
-rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index f1c48a6a3a1..cd1321ed832 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -426,8 +426,7 @@ void Parser::ParseObjCInterfaceDeclList(Decl *interfaceDecl, ObjCDeclSpec OCDS; // Parse property attribute list, if any. if (Tok.is(tok::l_paren)) - ParseObjCPropertyAttribute(OCDS, interfaceDecl, - allMethods.data(), allMethods.size()); + ParseObjCPropertyAttribute(OCDS, interfaceDecl); ObjCPropertyCallback Callback(*this, interfaceDecl, allProperties, OCDS, AtLoc, MethodImplKind); @@ -476,9 +475,7 @@ void Parser::ParseObjCInterfaceDeclList(Decl *interfaceDecl, /// copy /// nonatomic /// -void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS, Decl *ClassDecl, - Decl **Methods, - unsigned NumMethods) { +void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS, Decl *ClassDecl) { assert(Tok.getKind() == tok::l_paren); SourceLocation LHSLoc = ConsumeParen(); // consume '(' @@ -523,11 +520,9 @@ void Parser::ParseObjCPropertyAttribute(ObjCDeclSpec &DS, Decl *ClassDecl, if (Tok.is(tok::code_completion)) { if (IsSetter) - Actions.CodeCompleteObjCPropertySetter(getCurScope(), ClassDecl, - Methods, NumMethods); + Actions.CodeCompleteObjCPropertySetter(getCurScope(), ClassDecl); else - Actions.CodeCompleteObjCPropertyGetter(getCurScope(), ClassDecl, - Methods, NumMethods); + Actions.CodeCompleteObjCPropertyGetter(getCurScope(), ClassDecl); ConsumeCodeCompletionToken(); } |