diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-03-30 18:56:13 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-03-30 18:56:13 +0000 |
| commit | ad2c6988a28e5e506c29980c785a167c9b0f3294 (patch) | |
| tree | 5121f81f9a5a8de34b35a53d2bd35e501b07e4d6 /clang/lib/AST/Expr.cpp | |
| parent | 6ad816771420611d9947376dbade070e856fb929 (diff) | |
| download | bcm5719-llvm-ad2c6988a28e5e506c29980c785a167c9b0f3294.tar.gz bcm5719-llvm-ad2c6988a28e5e506c29980c785a167c9b0f3294.zip | |
Introduce new AST statistics that keep track of the number of isa (or
dyn_cast) invocations for C++ and Objective-C types, declarations,
expressions, and statements. The statistics will be printed when
-print-stats is provided to Clang -cc1, with results such as:
277073 clang - Number of checks for C++ declaration nodes
13311 clang - Number of checks for C++ expression nodes
18 clang - Number of checks for C++ statement nodes
174182 clang - Number of checks for C++ type nodes
92300 clang - Number of checks for Objective-C declaration nodes
9800 clang - Number of checks for Objective-C expression nodes
7 clang - Number of checks for Objective-C statement nodes
65733 clang - Number of checks for Objective-C type nodes
The statistics are only gathered when NDEBUG is not defined, since
they introduce potentially-expensive operations into very low-level
routines (isa).
llvm-svn: 99912
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
| -rw-r--r-- | clang/lib/AST/Expr.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index b4e5a5d9602..935a2080dcc 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -27,6 +27,13 @@ #include <algorithm> using namespace clang; +#ifndef NDEBUG +llvm::Statistic clang::objc_expr_checks = + { "clang", "Number of checks for Objective-C expression nodes", 0, 0 }; +llvm::Statistic clang::cxx_expr_checks = + { "clang", "Number of checks for C++ expression nodes", 0, 0 }; +#endif + //===----------------------------------------------------------------------===// // Primary Expressions. //===----------------------------------------------------------------------===// |

