summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-03 06:37:04 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-10-03 06:37:04 +0000
commitb8c3aaf479394516454c8ca617ca9cb6377130d2 (patch)
tree77264dd2bc93062620a4a7f85fe9fd93eab852e1 /clang/lib/Sema/SemaDeclObjC.cpp
parentb98e3714f2197ef0bb510c0143c369ac125da0c7 (diff)
downloadbcm5719-llvm-b8c3aaf479394516454c8ca617ca9cb6377130d2.tar.gz
bcm5719-llvm-b8c3aaf479394516454c8ca617ca9cb6377130d2.zip
Allow getting all source locations of selector identifiers in a ObjCMethodDecl.
Instead of always storing all source locations for the selector identifiers we check whether all the identifiers are in a "standard" position; "standard" position is -Immediately before the arguments: -(id)first:(int)x second:(int)y; -With a space between the arguments: -(id)first: (int)x second: (int)y; -For nullary selectors, immediately before ';': -(void)release; In such cases we infer the locations instead of storing them. llvm-svn: 140989
Diffstat (limited to 'clang/lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 3a34ffb5433..b4def893af8 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -171,10 +171,11 @@ void Sema::CheckObjCMethodOverride(ObjCMethodDecl *NewMethod,
Diag(Overridden->getLocation(), diag::note_previous_decl)
<< "method";
}
- for (ObjCMethodDecl::param_iterator oi = Overridden->param_begin(),
- ni = NewMethod->param_begin(), ne = NewMethod->param_end();
+ ObjCMethodDecl::param_const_iterator oi = Overridden->param_begin();
+ for (ObjCMethodDecl::param_iterator
+ ni = NewMethod->param_begin(), ne = NewMethod->param_end();
ni != ne; ++ni, ++oi) {
- ParmVarDecl *oldDecl = (*oi);
+ const ParmVarDecl *oldDecl = (*oi);
ParmVarDecl *newDecl = (*ni);
if (newDecl->hasAttr<NSConsumedAttr>() !=
oldDecl->hasAttr<NSConsumedAttr>()) {
@@ -1860,12 +1861,12 @@ bool Sema::MatchTwoMethodDeclarations(const ObjCMethodDecl *left,
!= right->hasAttr<NSConsumesSelfAttr>()))
return false;
- ObjCMethodDecl::param_iterator
+ ObjCMethodDecl::param_const_iterator
li = left->param_begin(), le = left->param_end(), ri = right->param_begin();
for (; li != le; ++li, ++ri) {
assert(ri != right->param_end() && "Param mismatch");
- ParmVarDecl *lparm = *li, *rparm = *ri;
+ const ParmVarDecl *lparm = *li, *rparm = *ri;
if (!matchTypes(Context, strategy, lparm->getType(), rparm->getType()))
return false;
@@ -2527,7 +2528,7 @@ Decl *Sema::ActOnMethodDeclaration(
}
ObjCMethodDecl* ObjCMethod =
- ObjCMethodDecl::Create(Context, MethodLoc, EndLoc, SelectorLocs, Sel,
+ ObjCMethodDecl::Create(Context, MethodLoc, EndLoc, Sel,
resultDeclType,
ResultTInfo,
CurContext,
@@ -2610,7 +2611,7 @@ Decl *Sema::ActOnMethodDeclaration(
Params.push_back(Param);
}
- ObjCMethod->setMethodParams(Context, Params.data(), Params.size());
+ ObjCMethod->setMethodParams(Context, Params, SelectorLocs);
ObjCMethod->setObjCDeclQualifier(
CvtQTToAstBitMask(ReturnQT.getObjCDeclQualifier()));
OpenPOWER on IntegriCloud