From 611ba3ea3300b71eb95dc4e45f20eee5dddd32e1 Mon Sep 17 00:00:00 2001
From: dim <dim@FreeBSD.org>
Date: Sun, 17 Jul 2011 15:40:56 +0000
Subject: Vendor import of clang trunk r135360:
 http://llvm.org/svn/llvm-project/cfe/trunk@135360

---
 lib/Parse/ParseAST.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'lib/Parse/ParseAST.cpp')

diff --git a/lib/Parse/ParseAST.cpp b/lib/Parse/ParseAST.cpp
index 21917b2..56584c9 100644
--- a/lib/Parse/ParseAST.cpp
+++ b/lib/Parse/ParseAST.cpp
@@ -57,6 +57,10 @@ void clang::ParseAST(Sema &S, bool PrintStats) {
     Stmt::CollectingStats(true);
   }
 
+  // Also turn on collection of stats inside of the Sema object.
+  bool OldCollectStats = PrintStats;
+  std::swap(OldCollectStats, S.CollectStats);
+
   ASTConsumer *Consumer = &S.getASTConsumer();
 
   llvm::OwningPtr<Parser> ParseOP(new Parser(S.getPreprocessor(), S));
@@ -95,9 +99,10 @@ void clang::ParseAST(Sema &S, bool PrintStats) {
     Consumer->HandleTopLevelDecl(DeclGroupRef(*I));
   
   Consumer->HandleTranslationUnit(S.getASTContext());
-  
+
+  std::swap(OldCollectStats, S.CollectStats);
   if (PrintStats) {
-    fprintf(stderr, "\nSTATISTICS:\n");
+    llvm::errs() << "\nSTATISTICS:\n";
     P.getActions().PrintStats();
     S.getASTContext().PrintStats();
     Decl::PrintStats();
-- 
cgit v1.1