summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-11-03 00:35:38 +0000
committerDouglas Gregor <dgregor@apple.com>2010-11-03 00:35:38 +0000
commit15417cfa56242d05f55e36da9de966ed469098f6 (patch)
tree3e58bf6edaaf7c07591af31c79d68e706abe509b /clang/lib/AST/ExprCXX.cpp
parent3e6c91946947050972b1ac929987e85e67ccf49d (diff)
downloadbcm5719-llvm-15417cfa56242d05f55e36da9de966ed469098f6.tar.gz
bcm5719-llvm-15417cfa56242d05f55e36da9de966ed469098f6.zip
Improve source-location information for CXXConstructExpr nodes, by
ensuring that they cover all of their child nodes. There's still a clang_getCursor()-related issue with CXXFunctionalCastExprs with CXXConstructExprs as children (see FIXME in the test case); I'll look at that separately. llvm-svn: 118132
Diffstat (limited to 'clang/lib/AST/ExprCXX.cpp')
-rw-r--r--clang/lib/AST/ExprCXX.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/clang/lib/AST/ExprCXX.cpp b/clang/lib/AST/ExprCXX.cpp
index a07d7840f0c..60785d471ac 100644
--- a/clang/lib/AST/ExprCXX.cpp
+++ b/clang/lib/AST/ExprCXX.cpp
@@ -347,9 +347,22 @@ StmtIterator DependentScopeDeclRefExpr::child_end() {
}
SourceRange CXXConstructExpr::getSourceRange() const {
- return ParenRange.isValid() ?
- SourceRange(Loc, ParenRange.getEnd()) :
- SourceRange(Loc);
+ if (ParenRange.isValid())
+ return SourceRange(Loc, ParenRange.getEnd());
+
+ SourceLocation End = Loc;
+ for (unsigned I = getNumArgs(); I > 0; --I) {
+ const Expr *Arg = getArg(I-1);
+ if (!Arg->isDefaultArgument()) {
+ SourceLocation NewEnd = Arg->getLocEnd();
+ if (NewEnd.isValid()) {
+ End = NewEnd;
+ break;
+ }
+ }
+ }
+
+ return SourceRange(Loc, End);
}
SourceRange CXXOperatorCallExpr::getSourceRange() const {
OpenPOWER on IntegriCloud