diff options
author | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-11-29 09:57:35 +0000 |
---|---|---|
committer | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-11-29 09:57:35 +0000 |
commit | f79bafa608a5d7c49ec40ad199af5e32f3038b47 (patch) | |
tree | e6822151874848d061a67b9bdc923a7d8a1ae7de /lib | |
parent | 63db522ab674cd2ab65366ce870ab164971919e6 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90073 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Frontend/CompilerInstance.cpp | 5 | ||||
-rw-r--r-- | lib/Frontend/FrontendAction.cpp | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index 872b7713f3..1cb5993fae 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/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/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index ff63a0dab5..91c946c9cf 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/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() { |