Added very lightweight, statically-allocated
counters for a variety of metrics associated
with expression parsing.  This should give some
idea of how much work the expression parser is
doing on Clang's behalf, and help with hopefully
reducing that load over time.

<rdar://problem/13210748> Audit type search/import for expressions

llvm-svn: 176714
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 1b62122..0788257 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -75,7 +75,9 @@
 
 bool 
 ClangExpressionDeclMap::WillParse(ExecutionContext &exe_ctx)
-{    
+{
+    ClangASTMetrics::ClearLocalCounters();
+    
     EnableParserVars();
     m_parser_vars->m_exe_ctx = exe_ctx;
     
@@ -111,6 +113,11 @@
 void 
 ClangExpressionDeclMap::DidParse()
 {
+    lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));
+
+    if (log)
+        ClangASTMetrics::DumpCounters(log);
+    
     if (m_parser_vars.get())
     {
         for (size_t entity_index = 0, num_entities = m_found_entities.GetSize();
@@ -2605,6 +2612,8 @@
 {
     assert (m_ast_context);
     
+    ClangASTMetrics::RegisterVisibleQuery();
+    
     const ConstString name(context.m_decl_name.getAsString().c_str());
     
     lldb::LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_EXPRESSIONS));