diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-06-16 00:46:02 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-06-16 00:46:02 +0000 |
commit | a0cff720d40f239fee0e5ecc8378122b456c1991 (patch) | |
tree | 208d410b6a8effba206193579ae69b29d3b636a0 /lib/AST/DeclObjC.cpp | |
parent | 843f0e87e5ab9b5b5c36b60e99a350d15679683a (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158583 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclObjC.cpp')
-rw-r--r-- | lib/AST/DeclObjC.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp index b6b3f7d4c0..37fb039142 100644 --- a/lib/AST/DeclObjC.cpp +++ b/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)) |