summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclObjC.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-06-16 00:46:02 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2012-06-16 00:46:02 +0000
commit33b4bfcef5385c39d8dab6181d53fcadc74756bf (patch)
tree4467b2ef79aa1a9f499c3c6f5bbf378964f010f8 /clang/lib/AST/DeclObjC.cpp
parent52de271da1d56fe80e924bb57659de96e06246fd (diff)
downloadbcm5719-llvm-33b4bfcef5385c39d8dab6181d53fcadc74756bf.tar.gz
bcm5719-llvm-33b4bfcef5385c39d8dab6181d53fcadc74756bf.zip
[AST/libclang] Fix the selector locations that are reported for a
method definition that has its '{' attached to the method name without a space. With a method like: -(id)meth{ ..... } the logic in ObjCMethodDecl that determined the selector locations got confused because it was initialized based on an end location for '{' but that end location changed to '}' after the method was finished. Fix this by having an immutable end location for the declarator and for getLocEnd() get the end location from the body itself. Fixes rdar://11659739. llvm-svn: 158583
Diffstat (limited to 'clang/lib/AST/DeclObjC.cpp')
-rw-r--r--clang/lib/AST/DeclObjC.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclObjC.cpp b/clang/lib/AST/DeclObjC.cpp
index b6b3f7d4c0a..37fb0391425 100644
--- a/clang/lib/AST/DeclObjC.cpp
+++ b/clang/lib/AST/DeclObjC.cpp
@@ -451,7 +451,8 @@ void ObjCMethodDecl::setMethodParams(ASTContext &C,
if (isImplicit())
return setParamsAndSelLocs(C, Params, ArrayRef<SourceLocation>());
- SelLocsKind = hasStandardSelectorLocs(getSelector(), SelLocs, Params, EndLoc);
+ SelLocsKind = hasStandardSelectorLocs(getSelector(), SelLocs, Params,
+ DeclEndLoc);
if (SelLocsKind != SelLoc_NonStandard)
return setParamsAndSelLocs(C, Params, ArrayRef<SourceLocation>());
@@ -523,6 +524,12 @@ ObjCMethodDecl *ObjCMethodDecl::getCanonicalDecl() {
return this;
}
+SourceLocation ObjCMethodDecl::getLocEnd() const {
+ if (Stmt *Body = getBody())
+ return Body->getLocEnd();
+ return DeclEndLoc;
+}
+
ObjCMethodFamily ObjCMethodDecl::getMethodFamily() const {
ObjCMethodFamily family = static_cast<ObjCMethodFamily>(Family);
if (family != static_cast<unsigned>(InvalidObjCMethodFamily))
OpenPOWER on IntegriCloud