[cfe-commits] r140984 - in /cfe/trunk: include/clang/AST/DeclObjC.h include/clang/Sema/Sema.h lib/AST/ASTImporter.cpp lib/AST/DeclObjC.cpp lib/CodeGen/CodeGenModule.cpp lib/Parse/ParseObjc.cpp lib/Sema/SemaDeclObjC.cpp lib/Sema/SemaObjCProperty.cpp lib/Serialization/ASTReaderDecl.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Sun Oct 2 23:36:36 PDT 2011
Author: akirtzidis
Date: Mon Oct 3 01:36:36 2011
New Revision: 140984
URL: http://llvm.org/viewvc/llvm-project?rev=140984&view=rev
Log:
Pass from the parser the locations of selector identifiers when creating
objc method decls.
They are not stored in the AST yet.
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=140984&r1=140983&r2=140984&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Mon Oct 3 01:36:36 2011
@@ -193,7 +193,9 @@
public:
static ObjCMethodDecl *Create(ASTContext &C,
SourceLocation beginLoc,
- SourceLocation endLoc, Selector SelInfo,
+ SourceLocation endLoc,
+ ArrayRef<SourceLocation> SelLocs,
+ Selector SelInfo,
QualType T,
TypeSourceInfo *ResultTInfo,
DeclContext *contextDecl,
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=140984&r1=140983&r2=140984&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Mon Oct 3 01:36:36 2011
@@ -5209,7 +5209,7 @@
SourceLocation EndLoc, // location of the ; or {.
tok::TokenKind MethodType,
ObjCDeclSpec &ReturnQT, ParsedType ReturnType,
- SourceLocation SelectorStartLoc, Selector Sel,
+ ArrayRef<SourceLocation> SelectorLocs, Selector Sel,
// optional arguments. The number of types/arguments is obtained
// from the Sel.getNumArgs().
ObjCArgInfo *ArgInfo,
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=140984&r1=140983&r2=140984&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Mon Oct 3 01:36:36 2011
@@ -2923,6 +2923,7 @@
= ObjCMethodDecl::Create(Importer.getToContext(),
Loc,
Importer.Import(D->getLocEnd()),
+ /*FIXME:*/ ArrayRef<SourceLocation>(),
Name.getObjCSelector(),
ResultTy, ResultTInfo, DC,
D->isInstanceMethod(),
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=140984&r1=140983&r2=140984&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Mon Oct 3 01:36:36 2011
@@ -332,6 +332,7 @@
ObjCMethodDecl *ObjCMethodDecl::Create(ASTContext &C,
SourceLocation beginLoc,
SourceLocation endLoc,
+ ArrayRef<SourceLocation> SelLocs,
Selector SelInfo, QualType T,
TypeSourceInfo *ResultTInfo,
DeclContext *contextDecl,
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=140984&r1=140983&r2=140984&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Oct 3 01:36:36 2011
@@ -2134,6 +2134,7 @@
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 @@
// 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,
Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=140984&r1=140983&r2=140984&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Mon Oct 3 01:36:36 2011
@@ -972,6 +972,7 @@
}
SmallVector<IdentifierInfo *, 12> KeyIdents;
+ SmallVector<SourceLocation, 12> KeyLocs;
SmallVector<Sema::ObjCArgInfo, 12> ArgInfos;
ParseScope PrototypeScope(this,
Scope::FunctionPrototypeScope|Scope::DeclScope);
@@ -1027,6 +1028,7 @@
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 @@
}
// 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 *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);
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=140984&r1=140983&r2=140984&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Oct 3 01:36:36 2011
@@ -2489,7 +2489,7 @@
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 @@
} 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,
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=140984&r1=140983&r2=140984&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Oct 3 01:36:36 2011
@@ -1518,6 +1518,7 @@
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 @@
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,
Modified: cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReaderDecl.cpp?rev=140984&r1=140983&r2=140984&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReaderDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReaderDecl.cpp Mon Oct 3 01:36:36 2011
@@ -1614,6 +1614,7 @@
case DECL_OBJC_METHOD:
D = ObjCMethodDecl::Create(Context, SourceLocation(), SourceLocation(),
+ ArrayRef<SourceLocation>(),
Selector(), QualType(), 0, 0);
break;
case DECL_OBJC_INTERFACE:
More information about the cfe-commits
mailing list