On Mar 30, 2010, at 11:56 AM, Douglas Gregor wrote: > Author: dgregor > Date: Tue Mar 30 13:56:13 2010 > New Revision: 99912 > > URL: http://llvm.org/viewvc/llvm-project?rev=99912&view=rev > Log: > 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).
Interesting, are these checks (without the instrumentation) expensive and worth optimizing? What do these metrics tell us? Instead of NDEBUG, how about only enabling it with expensive checks? -Chris > > > > Added: > cfe/trunk/include/clang/AST/Statistics.h (with props) > Modified: > cfe/trunk/include/clang/AST/DeclBase.h > cfe/trunk/include/clang/AST/DeclCXX.h > cfe/trunk/include/clang/AST/DeclFriend.h > cfe/trunk/include/clang/AST/DeclObjC.h > cfe/trunk/include/clang/AST/DeclTemplate.h > cfe/trunk/include/clang/AST/Expr.h > cfe/trunk/include/clang/AST/ExprCXX.h > cfe/trunk/include/clang/AST/ExprObjC.h > cfe/trunk/include/clang/AST/Stmt.h > cfe/trunk/include/clang/AST/StmtCXX.h > cfe/trunk/include/clang/AST/StmtObjC.h > cfe/trunk/include/clang/AST/Type.h > cfe/trunk/lib/AST/DeclBase.cpp > cfe/trunk/lib/AST/Expr.cpp > cfe/trunk/lib/AST/Stmt.cpp > cfe/trunk/lib/AST/Type.cpp > > Modified: cfe/trunk/include/clang/AST/DeclBase.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/DeclBase.h (original) > +++ cfe/trunk/include/clang/AST/DeclBase.h Tue Mar 30 13:56:13 2010 > @@ -15,6 +15,7 @@ > #define LLVM_CLANG_AST_DECLBASE_H > > #include "clang/AST/Attr.h" > +#include "clang/AST/Statistics.h" > #include "clang/AST/Type.h" > #include "clang/Basic/Specifiers.h" > #include "llvm/Support/PrettyStackTrace.h" > @@ -1069,6 +1070,15 @@ > } > }; > > +#ifndef NDEBUG > + /// \brief The number of times we have dynamically checked for an > + /// Objective-C-specific declaration node. > + extern llvm::Statistic objc_decl_checks; > + > + /// \brief The number of times we have dynamically checked for a > + /// C++-specific declaration node. > + extern llvm::Statistic cxx_decl_checks; > +#endif > > } // end clang. > > > Modified: cfe/trunk/include/clang/AST/DeclCXX.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/DeclCXX.h (original) > +++ cfe/trunk/include/clang/AST/DeclCXX.h Tue Mar 30 13:56:13 2010 > @@ -1881,4 +1881,18 @@ > > } // end namespace clang > > +// Enumerate C++ declarations > +CLANG_ISA_STATISTIC(NamespaceDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(UsingDirectiveDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(NamespaceAliasDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(CXXRecordDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(CXXMethodDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(CXXConstructorDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(CXXDestructorDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(CXXConversionDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(UsingDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(UsingShadowDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(LinkageSpecDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(StaticAssertDecl, cxx_decl_checks) > + > #endif > > Modified: cfe/trunk/include/clang/AST/DeclFriend.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclFriend.h?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/DeclFriend.h (original) > +++ cfe/trunk/include/clang/AST/DeclFriend.h Tue Mar 30 13:56:13 2010 > @@ -164,4 +164,7 @@ > > } > > +// Enumerate C++ declarations > +CLANG_ISA_STATISTIC(FriendDecl, cxx_decl_checks) > + > #endif > > Modified: cfe/trunk/include/clang/AST/DeclObjC.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/DeclObjC.h (original) > +++ cfe/trunk/include/clang/AST/DeclObjC.h Tue Mar 30 13:56:13 2010 > @@ -1397,4 +1397,22 @@ > }; > > } // end namespace clang > + > +// Enumerate Objective-C declarations > +CLANG_ISA_STATISTIC(ObjCIvarDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCAtDefsFieldDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCMethodDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCContainerDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCCategoryDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCProtocolDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCInterfaceDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCImplDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCCategoryImplDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCImplementationDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCPropertyDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCCompatibleAliasDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCPropertyImplDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCForwardProtocolDecl, objc_decl_checks) > +CLANG_ISA_STATISTIC(ObjCClassDecl, objc_decl_checks) > + > #endif > > Modified: cfe/trunk/include/clang/AST/DeclTemplate.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/DeclTemplate.h (original) > +++ cfe/trunk/include/clang/AST/DeclTemplate.h Tue Mar 30 13:56:13 2010 > @@ -1314,4 +1314,17 @@ > > } /* end of namespace clang */ > > +// Enumerate C++ declarations > +CLANG_ISA_STATISTIC(UnresolvedUsingTypenameDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(ClassTemplateSpecializationDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(ClassTemplatePartialSpecializationDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(TemplateTypeParmDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(UnresolvedUsingValueDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(NonTypeTemplateParmDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(TemplateDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(FunctionTemplateDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(ClassTemplateDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(TemplateTemplateParmDecl, cxx_decl_checks) > +CLANG_ISA_STATISTIC(FriendTemplateDecl, cxx_decl_checks) > + > #endif > > Modified: cfe/trunk/include/clang/AST/Expr.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Expr.h?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/Expr.h (original) > +++ cfe/trunk/include/clang/AST/Expr.h Tue Mar 30 13:56:13 2010 > @@ -3058,6 +3058,15 @@ > virtual child_iterator child_end(); > }; > > +#ifndef NDEBUG > + /// \brief The number of times we have dynamically checked for an > + /// Objective-C-specific expression node. > + extern llvm::Statistic objc_expr_checks; > + > + /// \brief The number of times we have dynamically checked for a > + /// C++-specific expression node. > + extern llvm::Statistic cxx_expr_checks; > +#endif > } // end namespace clang > > #endif > > Modified: cfe/trunk/include/clang/AST/ExprCXX.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/ExprCXX.h (original) > +++ cfe/trunk/include/clang/AST/ExprCXX.h Tue Mar 30 13:56:13 2010 > @@ -2134,4 +2134,35 @@ > > } // end namespace clang > > +// Enumerate C++ expressions > +CLANG_ISA_STATISTIC(CXXOperatorCallExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXMemberCallExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXNamedCastExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXStaticCastExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXDynamicCastExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXReinterpretCastExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXConstCastExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXFunctionalCastExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXTypeidExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXBoolLiteralExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXNullPtrLiteralExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXThisExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXThrowExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXDefaultArgExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXZeroInitValueExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXNewExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXDeleteExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXPseudoDestructorExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(UnresolvedLookupExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(UnaryTypeTraitExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(DependentScopeDeclRefExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXConstructExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXBindTemporaryExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXBindReferenceExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXExprWithTemporaries, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXTemporaryObjectExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXUnresolvedConstructExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(CXXDependentScopeMemberExpr, cxx_expr_checks) > +CLANG_ISA_STATISTIC(UnresolvedMemberExpr, cxx_expr_checks) > + > #endif > > Modified: cfe/trunk/include/clang/AST/ExprObjC.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprObjC.h?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/ExprObjC.h (original) > +++ cfe/trunk/include/clang/AST/ExprObjC.h Tue Mar 30 13:56:13 2010 > @@ -577,4 +577,16 @@ > > } // end namespace clang > > +// Enumerate Objective-C expressions > +CLANG_ISA_STATISTIC(ObjCStringLiteral, objc_expr_checks) > +CLANG_ISA_STATISTIC(ObjCEncodeExpr, objc_expr_checks) > +CLANG_ISA_STATISTIC(ObjCMessageExpr, objc_expr_checks) > +CLANG_ISA_STATISTIC(ObjCSelectorExpr, objc_expr_checks) > +CLANG_ISA_STATISTIC(ObjCProtocolExpr, objc_expr_checks) > +CLANG_ISA_STATISTIC(ObjCIvarRefExpr, objc_expr_checks) > +CLANG_ISA_STATISTIC(ObjCPropertyRefExpr, objc_expr_checks) > +CLANG_ISA_STATISTIC(ObjCImplicitSetterGetterRefExpr, objc_expr_checks) > +CLANG_ISA_STATISTIC(ObjCSuperExpr, objc_expr_checks) > +CLANG_ISA_STATISTIC(ObjCIsaExpr, objc_expr_checks) > + > #endif > > Added: cfe/trunk/include/clang/AST/Statistics.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Statistics.h?rev=99912&view=auto > ============================================================================== > --- cfe/trunk/include/clang/AST/Statistics.h (added) > +++ cfe/trunk/include/clang/AST/Statistics.h Tue Mar 30 13:56:13 2010 > @@ -0,0 +1,43 @@ > +//===--- Statistics.h - Helpers for Clang AST Statistics --------*- C++ > -*-===// > +// > +// The LLVM Compiler Infrastructure > +// > +// This file is distributed under the University of Illinois Open Source > +// License. See LICENSE.TXT for details. > +// > +//===----------------------------------------------------------------------===// > +// > +// This file provides helper classes, functions, and macros for tracking > +// various statistics about the Clang AST and its usage. > +// > +//===----------------------------------------------------------------------===// > +#ifndef LLVM_CLANG_AST_STATISTICS_H > +#define LLVM_CLANG_AST_STATISTICS_H > + > +#ifndef NDEBUG > +#include "llvm/ADT/Statistic.h" > +#include "llvm/Support/Casting.h" > + > +/** \brief Tracks the number of time the \c isa() function template is > + * used to try to cast to the given \c Type, by bumping the \c Counter. > + * > + * Note that this macro must be expanded in the global scope, and that > + * both the type and the counter will be assumed to reside within the > + * \c clang namespace. > + */ > +#define CLANG_ISA_STATISTIC(Type,Counter) \ > +namespace llvm { \ > +template <typename From> \ > +struct isa_impl<clang::Type, From> { \ > + static inline bool doit(const From &Val) { \ > + ++clang::Counter; \ > + return clang::Type::classof(&Val); \ > + } \ > +}; \ > +} > + > +#else > +#define CLANG_ISA_STATISTIC(Type,Counter) > +#endif > + > +#endif // LLVM_CLANG_AST_STATISTICS_H > > Propchange: cfe/trunk/include/clang/AST/Statistics.h > ------------------------------------------------------------------------------ > svn:eol-style = native > > Propchange: cfe/trunk/include/clang/AST/Statistics.h > ------------------------------------------------------------------------------ > svn:keywords = Id > > Propchange: cfe/trunk/include/clang/AST/Statistics.h > ------------------------------------------------------------------------------ > svn:mime-type = text/plain > > Modified: cfe/trunk/include/clang/AST/Stmt.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/Stmt.h (original) > +++ cfe/trunk/include/clang/AST/Stmt.h Tue Mar 30 13:56:13 2010 > @@ -21,6 +21,7 @@ > #include "clang/AST/StmtIterator.h" > #include "clang/AST/DeclGroup.h" > #include "clang/AST/FullExpr.h" > +#include "clang/AST/Statistics.h" > #include "llvm/ADT/SmallVector.h" > #include "clang/AST/ASTContext.h" > #include <string> > @@ -1360,6 +1361,16 @@ > virtual child_iterator child_end(); > }; > > +#ifndef NDEBUG > + /// \brief The number of times we have dynamically checked for an > + /// Objective-C-specific statement node. > + extern llvm::Statistic objc_stmt_checks; > + > + /// \brief The number of times we have dynamically checked for a > + /// C++-specific statement node. > + extern llvm::Statistic cxx_stmt_checks; > +#endif > + > } // end namespace clang > > #endif > > Modified: cfe/trunk/include/clang/AST/StmtCXX.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtCXX.h?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/StmtCXX.h (original) > +++ cfe/trunk/include/clang/AST/StmtCXX.h Tue Mar 30 13:56:13 2010 > @@ -107,7 +107,10 @@ > virtual child_iterator child_end(); > }; > > - > } // end namespace clang > > +// Enumerate C++ statements > +CLANG_ISA_STATISTIC(CXXCatchStmt, cxx_stmt_checks) > +CLANG_ISA_STATISTIC(CXXTryStmt, cxx_stmt_checks) > + > #endif > > Modified: cfe/trunk/include/clang/AST/StmtObjC.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/StmtObjC.h?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/StmtObjC.h (original) > +++ cfe/trunk/include/clang/AST/StmtObjC.h Tue Mar 30 13:56:13 2010 > @@ -304,4 +304,12 @@ > > } // end namespace clang > > +// Enumerate Objective-C statements > +CLANG_ISA_STATISTIC(ObjCAtTryStmt, objc_stmt_checks) > +CLANG_ISA_STATISTIC(ObjCAtCatchStmt, objc_stmt_checks) > +CLANG_ISA_STATISTIC(ObjCAtFinallyStmt, objc_stmt_checks) > +CLANG_ISA_STATISTIC(ObjCAtThrowStmt, objc_stmt_checks) > +CLANG_ISA_STATISTIC(ObjCAtSynchronizedStmt, objc_stmt_checks) > +CLANG_ISA_STATISTIC(ObjCForCollectionStmt, objc_stmt_checks) > + > #endif > > Modified: cfe/trunk/include/clang/AST/Type.h > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/include/clang/AST/Type.h (original) > +++ cfe/trunk/include/clang/AST/Type.h Tue Mar 30 13:56:13 2010 > @@ -18,6 +18,7 @@ > #include "clang/Basic/IdentifierTable.h" > #include "clang/Basic/Linkage.h" > #include "clang/AST/NestedNameSpecifier.h" > +#include "clang/AST/Statistics.h" > #include "clang/AST/TemplateName.h" > #include "llvm/Support/Casting.h" > #include "llvm/Support/type_traits.h" > @@ -3179,6 +3180,35 @@ > return cast<T>(getUnqualifiedDesugaredType()); > } > > +#ifndef NDEBUG > + /// \brief The number of times we have dynamically checked for an > + /// Objective-C-specific type node. > + extern llvm::Statistic objc_type_checks; > + > + /// \brief The number of times we have dynamically checked for a > + /// C++-specific type node. > + extern llvm::Statistic cxx_type_checks; > +#endif > } // end namespace clang > > +// Enumerate Objective-C types > +CLANG_ISA_STATISTIC(ObjCInterfaceType, objc_type_checks) > +CLANG_ISA_STATISTIC(ObjCObjectPointerType, objc_type_checks) > + > +// Enumerate C++ types > +CLANG_ISA_STATISTIC(ReferenceType, cxx_type_checks) > +CLANG_ISA_STATISTIC(LValueReferenceType, cxx_type_checks) > +CLANG_ISA_STATISTIC(RValueReferenceType, cxx_type_checks) > +CLANG_ISA_STATISTIC(MemberPointerType, cxx_type_checks) > +CLANG_ISA_STATISTIC(DependentSizedArrayType, cxx_type_checks) > +CLANG_ISA_STATISTIC(DependentSizedExtVectorType, cxx_type_checks) > +CLANG_ISA_STATISTIC(UnresolvedUsingType, cxx_type_checks) > +CLANG_ISA_STATISTIC(DecltypeType, cxx_type_checks) > +CLANG_ISA_STATISTIC(TemplateTypeParmType, cxx_type_checks) > +CLANG_ISA_STATISTIC(SubstTemplateTypeParmType, cxx_type_checks) > +CLANG_ISA_STATISTIC(TemplateSpecializationType, cxx_type_checks) > +CLANG_ISA_STATISTIC(QualifiedNameType, cxx_type_checks) > +CLANG_ISA_STATISTIC(InjectedClassNameType, cxx_type_checks) > +CLANG_ISA_STATISTIC(TypenameType, cxx_type_checks) > + > #endif > > Modified: cfe/trunk/lib/AST/DeclBase.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/lib/AST/DeclBase.cpp (original) > +++ cfe/trunk/lib/AST/DeclBase.cpp Tue Mar 30 13:56:13 2010 > @@ -35,6 +35,13 @@ > // Statistics > //===----------------------------------------------------------------------===// > > +#ifndef NDEBUG > +llvm::Statistic clang::objc_decl_checks = > + { "clang", "Number of checks for Objective-C declaration nodes", 0, 0 }; > +llvm::Statistic clang::cxx_decl_checks = > + { "clang", "Number of checks for C++ declaration nodes", 0, 0 }; > +#endif > + > #define DECL(Derived, Base) static int n##Derived##s = 0; > #include "clang/AST/DeclNodes.def" > > > Modified: cfe/trunk/lib/AST/Expr.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Expr.cpp?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/lib/AST/Expr.cpp (original) > +++ cfe/trunk/lib/AST/Expr.cpp Tue Mar 30 13:56:13 2010 > @@ -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. > //===----------------------------------------------------------------------===// > > Modified: cfe/trunk/lib/AST/Stmt.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Stmt.cpp?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/lib/AST/Stmt.cpp (original) > +++ cfe/trunk/lib/AST/Stmt.cpp Tue Mar 30 13:56:13 2010 > @@ -22,6 +22,13 @@ > #include <cstdio> > using namespace clang; > > +#ifndef NDEBUG > +llvm::Statistic clang::objc_stmt_checks = > + { "clang", "Number of checks for Objective-C statement nodes", 0, 0 }; > +llvm::Statistic clang::cxx_stmt_checks = > + { "clang", "Number of checks for C++ statement nodes", 0, 0 }; > +#endif > + > static struct StmtClassNameTable { > const char *Name; > unsigned Counter; > > Modified: cfe/trunk/lib/AST/Type.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Type.cpp?rev=99912&r1=99911&r2=99912&view=diff > ============================================================================== > --- cfe/trunk/lib/AST/Type.cpp (original) > +++ cfe/trunk/lib/AST/Type.cpp Tue Mar 30 13:56:13 2010 > @@ -22,6 +22,13 @@ > #include "llvm/Support/raw_ostream.h" > using namespace clang; > > +#ifndef NDEBUG > +llvm::Statistic clang::objc_type_checks = > + { "clang", "Number of checks for Objective-C type nodes", 0, 0 }; > +llvm::Statistic clang::cxx_type_checks = > + { "clang", "Number of checks for C++ type nodes", 0, 0 }; > +#endif > + > bool QualType::isConstant(QualType T, ASTContext &Ctx) { > if (T.isConstQualified()) > return true; > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
