diff options
author | Daniel Dunbar <daniel@zuster.org> | 2012-03-09 15:39:19 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2012-03-09 15:39:19 +0000 |
commit | b0ab5e9f5c49e5146b917b7916aa71dd12b40c0c (patch) | |
tree | 2d753df13c303b1f292f21f4546f7769a01b9f06 /clang/lib/AST/Expr.cpp | |
parent | b507f2718575a55a936372ed946feeac643be95b (diff) | |
download | bcm5719-llvm-b0ab5e9f5c49e5146b917b7916aa71dd12b40c0c.tar.gz bcm5719-llvm-b0ab5e9f5c49e5146b917b7916aa71dd12b40c0c.zip |
[AST] Reimplement Stmt::getLoc{Start,End} to dispatch to subclass overloads.
- getSourceRange() can be very expensive, we should try to avoid it if at all possible.
In conjunction with the previous commit I measured a ~2% speedup on 403.gcc/combine.c and a 3% speedup on OmniGroupFrameworks/NSBezierPath-OAExtensions.m.
llvm-svn: 152411
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 0266cd63bbc..8e2e64faf1d 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -94,6 +94,8 @@ bool Expr::isKnownToHaveBooleanValue() const { // Amusing macro metaprogramming hack: check whether a class provides // a more specific implementation of getExprLoc(). +// +// See also Stmt.cpp:{getLocStart(),getLocEnd()}. namespace { /// This implementation is used when a class provides a custom /// implementation of getExprLoc. @@ -110,7 +112,7 @@ namespace { template <class E> SourceLocation getExprLocImpl(const Expr *expr, SourceLocation (Expr::*v)() const) { - return static_cast<const E*>(expr)->getSourceRange().getBegin(); + return static_cast<const E*>(expr)->getLocStart(); } } |