diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-04-30 22:12:22 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2012-04-30 22:12:22 +0000 |
commit | 4548ca2912e5f2b78a20e50c58d8a1a9c5e9e67c (patch) | |
tree | 9a94eee3e1421d5f86099726ce3ba0eadea7cf39 /lib/AST/ExprCXX.cpp | |
parent | 89585e800122de7ee4ca74dfca1c86a11685528f (diff) |
Store the source range of a CXXOperatorCallExpr in the Expr object instead of
calculating it recursively.
boost::assign::tuple_list_of uses the trick of chaining call operator expressions in order to declare a "list of tuples", e.g:
std::vector<tuple> v = boost::assign::tuple_list_of(1, "foo")(2, "bar")(3, "qqq");
Due to CXXOperatorCallExpr calculating its source range recursively we would get
significant slowdowns with a large number of chained call operator expressions and the
potential for stack overflow.
rdar://11350116
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155848 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprCXX.cpp')
-rw-r--r-- | lib/AST/ExprCXX.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp index 8cf519c93d..8fbe72108b 100644 --- a/lib/AST/ExprCXX.cpp +++ b/lib/AST/ExprCXX.cpp @@ -415,7 +415,7 @@ SourceRange CXXConstructExpr::getSourceRange() const { return SourceRange(Loc, End); } -SourceRange CXXOperatorCallExpr::getSourceRange() const { +SourceRange CXXOperatorCallExpr::getSourceRangeImpl() const { OverloadedOperatorKind Kind = getOperator(); if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) { if (getNumArgs() == 1) @@ -438,7 +438,7 @@ SourceRange CXXOperatorCallExpr::getSourceRange() const { return SourceRange(getArg(0)->getSourceRange().getBegin(), getArg(1)->getSourceRange().getEnd()); } else { - return SourceRange(); + return getOperatorLoc(); } } |