summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex/Pragma.cpp
diff options
context:
space:
mode:
authorAndrew V. Tischenko <andrew.v.tischenko@gmail.com>2018-04-10 10:34:13 +0000
committerAndrew V. Tischenko <andrew.v.tischenko@gmail.com>2018-04-10 10:34:13 +0000
commitc88deb100f1d4a1d14dbcc42de01d325919ebec6 (patch)
tree36fe084ef5681b5e643f8eb90483a14f00df70d4 /clang/lib/Lex/Pragma.cpp
parent037d3b20d3c0d9ea5c90aec9de3a5257d46b70c9 (diff)
downloadbcm5719-llvm-c88deb100f1d4a1d14dbcc42de01d325919ebec6.tar.gz
bcm5719-llvm-c88deb100f1d4a1d14dbcc42de01d325919ebec6.zip
-ftime-report switch support in Clang.
The current support of the feature produces only 2 lines in report: -Some general Code Generation Time; -Total time of Backend Consumer actions. This patch extends Clang time report with new lines related to Preprocessor, Include Filea Search, Parsing, etc. Differential Revision: https://reviews.llvm.org/D43578 llvm-svn: 329684
Diffstat (limited to 'clang/lib/Lex/Pragma.cpp')
-rw-r--r--clang/lib/Lex/Pragma.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Lex/Pragma.cpp b/clang/lib/Lex/Pragma.cpp
index db32e452d07..a1944e30ffb 100644
--- a/clang/lib/Lex/Pragma.cpp
+++ b/clang/lib/Lex/Pragma.cpp
@@ -39,11 +39,13 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/SmallVector.h"
-#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/CrashRecoveryContext.h"
+#include "llvm/ADT/StringSwitch.h"
+#include "llvm/Pass.h"
#include "llvm/Support/Compiler.h"
+#include "llvm/Support/CrashRecoveryContext.h"
#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/Timer.h"
#include <algorithm>
#include <cassert>
#include <cstddef>
@@ -54,6 +56,8 @@
#include <vector>
using namespace clang;
+static const char *const GroupName = "clangparser";
+static const char *const GroupDescription = "===== Clang Parser =====";
// Out-of-line destructor to provide a home for the class.
PragmaHandler::~PragmaHandler() = default;
@@ -82,6 +86,8 @@ PragmaNamespace::~PragmaNamespace() {
/// the null handler isn't returned on failure to match.
PragmaHandler *PragmaNamespace::FindHandler(StringRef Name,
bool IgnoreNull) const {
+ llvm::NamedRegionTimer NRT("ppfindhandler", "PP Find Handler", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
if (PragmaHandler *Handler = Handlers.lookup(Name))
return Handler;
return IgnoreNull ? nullptr : Handlers.lookup(StringRef());
@@ -128,6 +134,8 @@ void PragmaNamespace::HandlePragma(Preprocessor &PP,
/// rest of the pragma, passing it to the registered pragma handlers.
void Preprocessor::HandlePragmaDirective(SourceLocation IntroducerLoc,
PragmaIntroducerKind Introducer) {
+ llvm::NamedRegionTimer NRT("pppragma", "Handle Pragma Directive", GroupName,
+ GroupDescription, llvm::TimePassesIsEnabled);
if (Callbacks)
Callbacks->PragmaDirective(IntroducerLoc, Introducer);
OpenPOWER on IntegriCloud