diff --git a/tools/ClangPlugin.cpp b/tools/ClangPlugin.cpp index 002e56daa..365b4c9d7 100644 --- a/tools/ClangPlugin.cpp +++ b/tools/ClangPlugin.cpp @@ -59,7 +59,6 @@ namespace { } } }; - } namespace clad { @@ -239,17 +238,16 @@ namespace clad { alreadyDerived = true; } else { // Only time the function when it is first encountered - std::shared_ptr tm = ctg.GetNewTimer("Timer for clad func", request.BaseFunctionName); - if(m_CI.getCodeGenOpts().TimePasses){ + std::shared_ptr tm = + ctg.GetNewTimer("Timer for clad func", request.BaseFunctionName); + if (m_CI.getCodeGenOpts().TimePasses) tm->startTimer(); - } auto deriveResult = m_DerivativeBuilder->Derive(request); DerivativeDecl = deriveResult.derivative; OverloadedDerivativeDecl = deriveResult.overload; - if(tm->isRunning()){ - tm->stopTimer(); - } + if (tm->isRunning()) + tm->stopTimer(); } } @@ -347,16 +345,18 @@ namespace clad { } } // end namespace plugin + clad::CladTimerGroup::CladTimerGroup() + : Tg("Timers for Clad Funcs", "Timers for Clad Funcs") {} - clad::CladTimerGroup::CladTimerGroup(): Tg("Timers for Clad Funcs", "Timers for Clad Funcs"){ - } - - std::shared_ptr clad::CladTimerGroup::GetNewTimer(const llvm::StringRef TimerName, const llvm::StringRef TimerDesc){ - std::shared_ptr tm = std::make_shared(TimerName, TimerDesc, Tg); + std::shared_ptr + clad::CladTimerGroup::GetNewTimer(const llvm::StringRef TimerName, + const llvm::StringRef TimerDesc) { + std::shared_ptr tm = + std::make_shared(TimerName, TimerDesc, Tg); Timers.push_back(tm); return tm; } - + // Routine to check clang version at runtime against the clang version for // which clad was built. bool checkClangVersion() { diff --git a/tools/ClangPlugin.h b/tools/ClangPlugin.h index 6d398937a..340baa2d6 100644 --- a/tools/ClangPlugin.h +++ b/tools/ClangPlugin.h @@ -61,14 +61,15 @@ namespace clad { /// object that represents the same derivative object as the provided /// argument `DFI`. bool AlreadyExists(const DerivedFnInfo& DFI) const; - }; class CladTimerGroup { llvm::TimerGroup Tg; std::vector> Timers; - public: + + public: CladTimerGroup(); - std::shared_ptr GetNewTimer(const llvm::StringRef TimerName, const llvm::StringRef TimerDesc); + std::shared_ptr GetNewTimer(const llvm::StringRef TimerName, + const llvm::StringRef TimerDesc); } ctg; namespace plugin {