summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-04-17 01:56:48 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-04-17 01:56:48 +0000
commita077279184e39f7ec25e1a491e47bf51c25355d5 (patch)
treeef88c0a0ac9c30c3d8693763daee5de2e90afb81 /clang/lib/AST/Decl.cpp
parent406503a0f908196e67322500502ccc13c928c2f4 (diff)
downloadbcm5719-llvm-a077279184e39f7ec25e1a491e47bf51c25355d5.tar.gz
bcm5719-llvm-a077279184e39f7ec25e1a491e47bf51c25355d5.zip
Correct the range returned by ParmVarDecl::getSourceRange(), for parameters in ObjC methods with postfix types.
For a parameter in a method like this: -(int)methodWithFn:(void (*)(int *p))fn; we would return the source range of the type and not include the parameter name. Fixes rdar://13668626. llvm-svn: 179660
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index d572335fb3d..4a3e8781dee 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1892,6 +1892,11 @@ SourceRange ParmVarDecl::getSourceRange() const {
return SourceRange(getOuterLocStart(), ArgRange.getEnd());
}
+ // DeclaratorDecl considers the range of postfix types as overlapping with the
+ // declaration name, but this is not the case with parameters in ObjC methods.
+ if (isa<ObjCMethodDecl>(getDeclContext()))
+ return SourceRange(DeclaratorDecl::getLocStart(), getLocation());
+
return DeclaratorDecl::getSourceRange();
}
OpenPOWER on IntegriCloud