summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2009-11-29 09:57:35 +0000
committerKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2009-11-29 09:57:35 +0000
commit5505dff8afb21fd57e7c4ba5ef453934287e4170 (patch)
tree15d76399d5cb9c829419c31234f1c16ebcac4555 /clang/lib
parente97582406b066b9fd4be1a573da0498a4bb6783f (diff)
downloadbcm5719-llvm-5505dff8afb21fd57e7c4ba5ef453934287e4170.tar.gz
bcm5719-llvm-5505dff8afb21fd57e7c4ba5ef453934287e4170.zip
This patch moves the frontend timer from clang-cc into CompilerInstance.
CompilerInstance already contains various objects that are used throughout the entire run. Also addresses Daniels review comments in: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20091123/024508.html llvm-svn: 90073
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp5
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp9
2 files changed, 11 insertions, 3 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index 872b7713f32..1cb5993faef 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -27,6 +27,7 @@
#include "llvm/LLVMContext.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Timer.h"
#include "llvm/System/Path.h"
using namespace clang;
@@ -257,6 +258,10 @@ void CompilerInstance::createCodeCompletionConsumer() {
llvm::outs()));
}
+void CompilerInstance::createFrontendTimer() {
+ FrontendTimer.reset(new llvm::Timer("Clang front-end timer"));
+}
+
CodeCompleteConsumer *
CompilerInstance::createCodeCompletionConsumer(Preprocessor &PP,
const std::string &Filename,
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index ff63a0dab5f..91c946c9cf2 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -21,7 +21,7 @@
#include "llvm/Support/raw_ostream.h"
using namespace clang;
-FrontendAction::FrontendAction() : Instance(0), CurrentTimer(0) {}
+FrontendAction::FrontendAction() : Instance(0) {}
FrontendAction::~FrontendAction() {}
@@ -144,8 +144,11 @@ void FrontendAction::Execute() {
return;
}
- llvm::TimeRegion Timer(CurrentTimer);
- ExecuteAction();
+ if (CI.hasFrontendTimer()) {
+ llvm::TimeRegion Timer(CI.getFrontendTimer());
+ ExecuteAction();
+ }
+ else ExecuteAction();
}
void FrontendAction::EndSourceFile() {
OpenPOWER on IntegriCloud