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 /include/clang/Frontend | |
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 'include/clang/Frontend')
-rw-r--r-- | include/clang/Frontend/CompilerInstance.h | 18 | ||||
-rw-r--r-- | include/clang/Frontend/FrontendAction.h | 17 |
2 files changed, 18 insertions, 17 deletions
diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index ed28050877..d7e7d991f3 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -21,6 +21,7 @@ namespace llvm { class LLVMContext; class raw_ostream; class raw_fd_ostream; +class Timer; } namespace clang { @@ -89,6 +90,9 @@ class CompilerInstance { /// The code completion consumer. llvm::OwningPtr<CodeCompleteConsumer> CompletionConsumer; + /// The frontend timer + llvm::OwningPtr<llvm::Timer> FrontendTimer; + /// The list of active output files. std::list< std::pair<std::string, llvm::raw_ostream*> > OutputFiles; @@ -367,6 +371,17 @@ public: void setCodeCompletionConsumer(CodeCompleteConsumer *Value); /// } + /// @name Frontend timer + /// { + + bool hasFrontendTimer() const { return FrontendTimer != 0; } + + llvm::Timer &getFrontendTimer() const { + assert(FrontendTimer && "Compiler instance has no frontend timer!"); + return *FrontendTimer; + } + + /// } /// @name Output Files /// { @@ -462,6 +477,9 @@ public: bool UseDebugPrinter, bool ShowMacros, llvm::raw_ostream &OS); + /// Create the frontend timer and replace any existing one with it. + void createFrontendTimer(); + /// Create the default output file (from the invocation's options) and add it /// to the list of tracked output files. llvm::raw_fd_ostream * diff --git a/include/clang/Frontend/FrontendAction.h b/include/clang/Frontend/FrontendAction.h index 469ea535f6..3042767af8 100644 --- a/include/clang/Frontend/FrontendAction.h +++ b/include/clang/Frontend/FrontendAction.h @@ -14,10 +14,6 @@ #include "llvm/ADT/OwningPtr.h" #include <string> -namespace llvm { -class Timer; -} - namespace clang { class ASTUnit; class ASTConsumer; @@ -29,7 +25,6 @@ class FrontendAction { std::string CurrentFile; llvm::OwningPtr<ASTUnit> CurrentASTUnit; CompilerInstance *Instance; - llvm::Timer *CurrentTimer; protected: /// @name Implementation Action Interface @@ -112,18 +107,6 @@ public: void setCurrentFile(llvm::StringRef Value, ASTUnit *AST = 0); /// @} - /// @name Timing Utilities - /// @{ - - llvm::Timer *getCurrentTimer() const { - return CurrentTimer; - } - - void setCurrentTimer(llvm::Timer *Value) { - CurrentTimer = Value; - } - - /// @} /// @name Supported Modes /// @{ |