Skip to content

Commit

Permalink
formatting fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
DeadSpheroid committed Feb 24, 2024
1 parent 39c5ff6 commit 97a8c4e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
26 changes: 13 additions & 13 deletions tools/ClangPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ namespace {
}
}
};

}

namespace clad {
Expand Down Expand Up @@ -239,17 +238,16 @@ namespace clad {
alreadyDerived = true;
} else {
// Only time the function when it is first encountered
std::shared_ptr<llvm::Timer> tm = ctg.GetNewTimer("Timer for clad func", request.BaseFunctionName);
if(m_CI.getCodeGenOpts().TimePasses){
std::shared_ptr<llvm::Timer> tm =
ctg.GetNewTimer("Timer for clad func", request.BaseFunctionName);
if (m_CI.getCodeGenOpts().TimePasses)
tm->startTimer();

Check warning on line 244 in tools/ClangPlugin.cpp

View check run for this annotation

Codecov / codecov/patch

tools/ClangPlugin.cpp#L244

Added line #L244 was not covered by tests
}

auto deriveResult = m_DerivativeBuilder->Derive(request);
DerivativeDecl = deriveResult.derivative;
OverloadedDerivativeDecl = deriveResult.overload;
if(tm->isRunning()){
tm->stopTimer();
}
if (tm->isRunning())
tm->stopTimer();

Check warning on line 250 in tools/ClangPlugin.cpp

View check run for this annotation

Codecov / codecov/patch

tools/ClangPlugin.cpp#L250

Added line #L250 was not covered by tests
}
}

Expand Down Expand Up @@ -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<llvm::Timer> clad::CladTimerGroup::GetNewTimer(const llvm::StringRef TimerName, const llvm::StringRef TimerDesc){
std::shared_ptr<llvm::Timer> tm = std::make_shared<llvm::Timer>(TimerName, TimerDesc, Tg);
std::shared_ptr<llvm::Timer>
clad::CladTimerGroup::GetNewTimer(const llvm::StringRef TimerName,
const llvm::StringRef TimerDesc) {
std::shared_ptr<llvm::Timer> tm =
std::make_shared<llvm::Timer>(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() {
Expand Down
7 changes: 4 additions & 3 deletions tools/ClangPlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::shared_ptr<llvm::Timer>> Timers;
public:

public:
CladTimerGroup();
std::shared_ptr<llvm::Timer> GetNewTimer(const llvm::StringRef TimerName, const llvm::StringRef TimerDesc);
std::shared_ptr<llvm::Timer> GetNewTimer(const llvm::StringRef TimerName,
const llvm::StringRef TimerDesc);
} ctg;

namespace plugin {
Expand Down

0 comments on commit 97a8c4e

Please sign in to comment.