summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Decl.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-07-30 17:23:26 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-07-30 17:23:26 +0000
commit4c6efa62e057da00d0645be3afccd922e43fa4d8 (patch)
treee916f994ef69678600ed4ad1d621ae9ce7e232ee /clang/lib/AST/Decl.cpp
parenteb5ea833ed7e095f13b93120114e9649767339fc (diff)
downloadbcm5719-llvm-4c6efa62e057da00d0645be3afccd922e43fa4d8.tar.gz
bcm5719-llvm-4c6efa62e057da00d0645be3afccd922e43fa4d8.zip
[libclang] Annotation of parameters that got default args from a previous declarations was
broken because the end location of the parameter was the end location of the default arg, resulting in a source range that could begin in one file and end in another. llvm-svn: 136572
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r--clang/lib/AST/Decl.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index ed8171d3ef1..64fd355446a 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1388,6 +1388,16 @@ ParmVarDecl *ParmVarDecl::Create(ASTContext &C, DeclContext *DC,
S, SCAsWritten, DefArg);
}
+SourceRange ParmVarDecl::getSourceRange() const {
+ if (!hasInheritedDefaultArg()) {
+ SourceRange ArgRange = getDefaultArgRange();
+ if (ArgRange.isValid())
+ return SourceRange(getOuterLocStart(), ArgRange.getEnd());
+ }
+
+ return DeclaratorDecl::getSourceRange();
+}
+
Expr *ParmVarDecl::getDefaultArg() {
assert(!hasUnparsedDefaultArg() && "Default argument is not yet parsed!");
assert(!hasUninstantiatedDefaultArg() &&
OpenPOWER on IntegriCloud