TimeRecord Start;
std::string Output;
- public:
+ public:
explicit SimpleTimer(bool WantTiming) : WantTiming(WantTiming) {
- Start = TimeRecord::getCurrentTime();
- }
-
- void setOutput(llvm::StringRef Output) {
if (WantTiming)
- this->Output = Output;
+ Start = TimeRecord::getCurrentTime();
}
- void setOutput(llvm::Twine Output) {
+ void setOutput(const llvm::Twine &Output) {
if (WantTiming)
- this->Output = Output.str();
+ this->Output = Output.str();
}
- void setOutput(const char *Output) {
- if (WantTiming)
- this->Output = Output;
- }
-
~SimpleTimer() {
if (WantTiming) {
TimeRecord Elapsed = TimeRecord::getCurrentTime();
return;
SimpleTimer Timer(WantTiming);
- if (WantTiming)
- Timer.setOutput( "Cache global code completions for " + getMainFileName());
+ Timer.setOutput("Cache global code completions for " + getMainFileName());
// Clear out the previous results.
ClearCachedCompletionResults();
// We did not previously compute a preamble, or it can't be reused anyway.
SimpleTimer PreambleTimer(WantTiming);
- if (WantTiming)
- PreambleTimer.setOutput("Precompiling preamble");
+ PreambleTimer.setOutput("Precompiling preamble");
// Create a new buffer that stores the preamble. The buffer also contains
// extra space for the original contents of the file (which will be present
}
SimpleTimer ParsingTimer(WantTiming);
- if (WantTiming)
- ParsingTimer.setOutput( "Parsing " + getMainFileName());
+ ParsingTimer.setOutput("Parsing " + getMainFileName());
return Parse(OverrideMainBuffer);
}
return true;
SimpleTimer ParsingTimer(WantTiming);
- if (WantTiming)
- ParsingTimer.setOutput( "Reparsing " + getMainFileName());
+ ParsingTimer.setOutput("Reparsing " + getMainFileName());
// Remap files.
PreprocessorOptions &PPOpts = Invocation->getPreprocessorOpts();
return;
SimpleTimer CompletionTimer(WantTiming);
- if (WantTiming) {
- llvm::SmallString<128> TimerName;
- llvm::raw_svector_ostream TimerNameOut(TimerName);
- TimerNameOut << "Code completion @ " << File << ":" << Line << ":"
- << Column;
- CompletionTimer.setOutput(TimerNameOut.str());
- }
+ CompletionTimer.setOutput("Code completion @ " + File + ":" +
+ llvm::Twine(Line) + ":" + llvm::Twine(Column));
CompilerInvocation CCInvocation(*Invocation);
FrontendOptions &FrontendOpts = CCInvocation.getFrontendOpts();