diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-03 06:36:36 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-10-03 06:36:36 +0000 |
| commit | dfd657064376ff288fe23318ccc51164b61677ef (patch) | |
| tree | 7e2e177cf72cfcd921e3073c636c8c521dc4ce1b /clang/lib | |
| parent | 3849394b819c05fdbd1c3437c263b75482ebdb34 (diff) | |
| download | bcm5719-llvm-dfd657064376ff288fe23318ccc51164b61677ef.tar.gz bcm5719-llvm-dfd657064376ff288fe23318ccc51164b61677ef.zip | |
Pass from the parser the locations of selector identifiers when creating
objc method decls.
They are not stored in the AST yet.
llvm-svn: 140984
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/AST/DeclObjC.cpp | 1 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 5 | ||||
| -rw-r--r-- | clang/lib/Parse/ParseObjc.cpp | 7 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclObjC.cpp | 7 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaObjCProperty.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 1 |
7 files changed, 17 insertions, 8 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index 09151a7888e..7c866cd88c9 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -2923,6 +2923,7 @@ Decl *ASTNodeImporter::VisitObjCMethodDecl(ObjCMethodDecl *D) { = ObjCMethodDecl::Create(Importer.getToContext(), Loc, Importer.Import(D->getLocEnd()), + /*FIXME:*/ ArrayRef<SourceLocation>(), Name.getObjCSelector(), ResultTy, ResultTInfo, DC, D->isInstanceMethod(), diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp index a461eaaeaec..0e1e833d2fd 100644 --- a/clang/lib/AST/DeclObjC.cpp +++ b/clang/lib/AST/DeclObjC.cpp @@ -332,6 +332,7 @@ ObjCMethodDecl *ObjCInterfaceDecl::lookupPrivateMethod( ObjCMethodDecl *ObjCMethodDecl::Create(ASTContext &C, SourceLocation beginLoc, SourceLocation endLoc, + ArrayRef<SourceLocation> SelLocs, Selector SelInfo, QualType T, TypeSourceInfo *ResultTInfo, DeclContext *contextDecl, diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index cde71e7ed8e..6e8e439107e 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -2134,6 +2134,7 @@ void CodeGenModule::EmitObjCIvarInitializations(ObjCImplementationDecl *D) { Selector cxxSelector = getContext().Selectors.getSelector(0, &II); ObjCMethodDecl *DTORMethod = ObjCMethodDecl::Create(getContext(), D->getLocation(), D->getLocation(), + ArrayRef<SourceLocation>(), cxxSelector, getContext().VoidTy, 0, D, /*isInstance=*/true, /*isVariadic=*/false, /*isSynthesized=*/true, /*isImplicitlyDeclared=*/true, @@ -2153,7 +2154,9 @@ void CodeGenModule::EmitObjCIvarInitializations(ObjCImplementationDecl *D) { // The constructor returns 'self'. ObjCMethodDecl *CTORMethod = ObjCMethodDecl::Create(getContext(), D->getLocation(), - D->getLocation(), cxxSelector, + D->getLocation(), + ArrayRef<SourceLocation>(), + cxxSelector, getContext().getObjCIdType(), 0, D, /*isInstance=*/true, /*isVariadic=*/false, diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp index 44808c89224..1b482258373 100644 --- a/clang/lib/Parse/ParseObjc.cpp +++ b/clang/lib/Parse/ParseObjc.cpp @@ -972,6 +972,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, } SmallVector<IdentifierInfo *, 12> KeyIdents; + SmallVector<SourceLocation, 12> KeyLocs; SmallVector<Sema::ObjCArgInfo, 12> ArgInfos; ParseScope PrototypeScope(this, Scope::FunctionPrototypeScope|Scope::DeclScope); @@ -1027,6 +1028,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, ArgInfos.push_back(ArgInfo); KeyIdents.push_back(SelIdent); + KeyLocs.push_back(selLoc); // Make sure the attributes persist. allParamAttrs.takeAllFrom(paramAttrs.getPool()); @@ -1044,8 +1046,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, } // Check for another keyword selector. - SourceLocation Loc; - SelIdent = ParseObjCSelectorPiece(Loc); + SelIdent = ParseObjCSelectorPiece(selLoc); if (!SelIdent && Tok.isNot(tok::colon)) break; // We have a selector or a colon, continue parsing. @@ -1088,7 +1089,7 @@ Decl *Parser::ParseObjCMethodDecl(SourceLocation mLoc, Decl *Result = Actions.ActOnMethodDeclaration(getCurScope(), mLoc, Tok.getLocation(), mType, DSRet, ReturnType, - selLoc, Sel, &ArgInfos[0], + KeyLocs, Sel, &ArgInfos[0], CParamInfo.data(), CParamInfo.size(), methodAttrs.getList(), MethodImplKind, isVariadic, MethodDefinition); diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp index 23e44748c8a..3a34ffb5433 100644 --- a/clang/lib/Sema/SemaDeclObjC.cpp +++ b/clang/lib/Sema/SemaDeclObjC.cpp @@ -2489,7 +2489,7 @@ Decl *Sema::ActOnMethodDeclaration( SourceLocation MethodLoc, SourceLocation EndLoc, tok::TokenKind MethodType, ObjCDeclSpec &ReturnQT, ParsedType ReturnType, - SourceLocation SelectorStartLoc, + ArrayRef<SourceLocation> SelectorLocs, Selector Sel, // optional arguments. The number of types/arguments is obtained // from the Sel.getNumArgs(). @@ -2523,11 +2523,12 @@ Decl *Sema::ActOnMethodDeclaration( } else { // get the type for "id". resultDeclType = Context.getObjCIdType(); Diag(MethodLoc, diag::warn_missing_method_return_type) - << FixItHint::CreateInsertion(SelectorStartLoc, "(id)"); + << FixItHint::CreateInsertion(SelectorLocs.front(), "(id)"); } ObjCMethodDecl* ObjCMethod = - ObjCMethodDecl::Create(Context, MethodLoc, EndLoc, Sel, resultDeclType, + ObjCMethodDecl::Create(Context, MethodLoc, EndLoc, SelectorLocs, Sel, + resultDeclType, ResultTInfo, CurContext, MethodType == tok::minus, isVariadic, diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp index 655adde37e2..a6f21fbf963 100644 --- a/clang/lib/Sema/SemaObjCProperty.cpp +++ b/clang/lib/Sema/SemaObjCProperty.cpp @@ -1518,6 +1518,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, property->getLocation(); GetterMethod = ObjCMethodDecl::Create(Context, Loc, Loc, + ArrayRef<SourceLocation>(), property->getGetterName(), property->getType(), 0, CD, /*isInstance=*/true, /*isVariadic=*/false, /*isSynthesized=*/true, @@ -1555,7 +1556,7 @@ void Sema::ProcessPropertyDecl(ObjCPropertyDecl *property, property->getLocation(); SetterMethod = - ObjCMethodDecl::Create(Context, Loc, Loc, + ObjCMethodDecl::Create(Context, Loc, Loc, ArrayRef<SourceLocation>(), property->getSetterName(), Context.VoidTy, 0, CD, /*isInstance=*/true, /*isVariadic=*/false, /*isSynthesized=*/true, diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 53155b118e6..f370f866867 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -1614,6 +1614,7 @@ Decl *ASTReader::ReadDeclRecord(DeclID ID) { case DECL_OBJC_METHOD: D = ObjCMethodDecl::Create(Context, SourceLocation(), SourceLocation(), + ArrayRef<SourceLocation>(), Selector(), QualType(), 0, 0); break; case DECL_OBJC_INTERFACE: |

