summaryrefslogtreecommitdiffstats
path: root/lld/Common
diff options
context:
space:
mode:
Diffstat (limited to 'lld/Common')
-rw-r--r--lld/Common/Args.cpp76
-rw-r--r--lld/Common/ErrorHandler.cpp110
-rw-r--r--lld/Common/Filesystem.cpp42
-rw-r--r--lld/Common/Memory.cpp12
-rw-r--r--lld/Common/Reproduce.cpp50
-rw-r--r--lld/Common/Strings.cpp92
-rw-r--r--lld/Common/Threads.cpp2
-rw-r--r--lld/Common/Timer.cpp54
8 files changed, 219 insertions, 219 deletions
diff --git a/lld/Common/Args.cpp b/lld/Common/Args.cpp
index 0691189a156..4ea3a435c7a 100644
--- a/lld/Common/Args.cpp
+++ b/lld/Common/Args.cpp
@@ -19,64 +19,64 @@ using namespace lld;
// TODO(sbc): Remove this once CGOptLevel can be set completely based on bitcode
// function metadata.
-CodeGenOpt::Level lld::args::getCGOptLevel(int OptLevelLTO) {
- if (OptLevelLTO == 3)
+CodeGenOpt::Level lld::args::getCGOptLevel(int optLevelLTO) {
+ if (optLevelLTO == 3)
return CodeGenOpt::Aggressive;
- assert(OptLevelLTO < 3);
+ assert(optLevelLTO < 3);
return CodeGenOpt::Default;
}
-int64_t lld::args::getInteger(opt::InputArgList &Args, unsigned Key,
+int64_t lld::args::getInteger(opt::InputArgList &args, unsigned key,
int64_t Default) {
- auto *A = Args.getLastArg(Key);
- if (!A)
+ auto *a = args.getLastArg(key);
+ if (!a)
return Default;
- int64_t V;
- if (to_integer(A->getValue(), V, 10))
- return V;
+ int64_t v;
+ if (to_integer(a->getValue(), v, 10))
+ return v;
- StringRef Spelling = Args.getArgString(A->getIndex());
- error(Spelling + ": number expected, but got '" + A->getValue() + "'");
+ StringRef spelling = args.getArgString(a->getIndex());
+ error(spelling + ": number expected, but got '" + a->getValue() + "'");
return 0;
}
-std::vector<StringRef> lld::args::getStrings(opt::InputArgList &Args, int Id) {
- std::vector<StringRef> V;
- for (auto *Arg : Args.filtered(Id))
- V.push_back(Arg->getValue());
- return V;
+std::vector<StringRef> lld::args::getStrings(opt::InputArgList &args, int id) {
+ std::vector<StringRef> v;
+ for (auto *arg : args.filtered(id))
+ v.push_back(arg->getValue());
+ return v;
}
-uint64_t lld::args::getZOptionValue(opt::InputArgList &Args, int Id,
- StringRef Key, uint64_t Default) {
- for (auto *Arg : Args.filtered_reverse(Id)) {
- std::pair<StringRef, StringRef> KV = StringRef(Arg->getValue()).split('=');
- if (KV.first == Key) {
- uint64_t Result = Default;
- if (!to_integer(KV.second, Result))
- error("invalid " + Key + ": " + KV.second);
- return Result;
+uint64_t lld::args::getZOptionValue(opt::InputArgList &args, int id,
+ StringRef key, uint64_t Default) {
+ for (auto *arg : args.filtered_reverse(id)) {
+ std::pair<StringRef, StringRef> kv = StringRef(arg->getValue()).split('=');
+ if (kv.first == key) {
+ uint64_t result = Default;
+ if (!to_integer(kv.second, result))
+ error("invalid " + key + ": " + kv.second);
+ return result;
}
}
return Default;
}
-std::vector<StringRef> lld::args::getLines(MemoryBufferRef MB) {
- SmallVector<StringRef, 0> Arr;
- MB.getBuffer().split(Arr, '\n');
+std::vector<StringRef> lld::args::getLines(MemoryBufferRef mb) {
+ SmallVector<StringRef, 0> arr;
+ mb.getBuffer().split(arr, '\n');
- std::vector<StringRef> Ret;
- for (StringRef S : Arr) {
- S = S.trim();
- if (!S.empty() && S[0] != '#')
- Ret.push_back(S);
+ std::vector<StringRef> ret;
+ for (StringRef s : arr) {
+ s = s.trim();
+ if (!s.empty() && s[0] != '#')
+ ret.push_back(s);
}
- return Ret;
+ return ret;
}
-StringRef lld::args::getFilenameWithoutExe(StringRef Path) {
- if (Path.endswith_lower(".exe"))
- return sys::path::stem(Path);
- return sys::path::filename(Path);
+StringRef lld::args::getFilenameWithoutExe(StringRef path) {
+ if (path.endswith_lower(".exe"))
+ return sys::path::stem(path);
+ return sys::path::filename(path);
}
diff --git a/lld/Common/ErrorHandler.cpp b/lld/Common/ErrorHandler.cpp
index 7c68353069f..f5d3eb44848 100644
--- a/lld/Common/ErrorHandler.cpp
+++ b/lld/Common/ErrorHandler.cpp
@@ -26,29 +26,29 @@ using namespace lld;
// The functions defined in this file can be called from multiple threads,
// but outs() or errs() are not thread-safe. We protect them using a mutex.
-static std::mutex Mu;
+static std::mutex mu;
// Prints "\n" or does nothing, depending on Msg contents of
// the previous call of this function.
-static void newline(raw_ostream *ErrorOS, const Twine &Msg) {
+static void newline(raw_ostream *errorOS, const Twine &msg) {
// True if the previous error message contained "\n".
// We want to separate multi-line error messages with a newline.
- static bool Flag;
+ static bool flag;
- if (Flag)
- *ErrorOS << "\n";
- Flag = StringRef(Msg.str()).contains('\n');
+ if (flag)
+ *errorOS << "\n";
+ flag = StringRef(msg.str()).contains('\n');
}
ErrorHandler &lld::errorHandler() {
- static ErrorHandler Handler;
- return Handler;
+ static ErrorHandler handler;
+ return handler;
}
-void lld::exitLld(int Val) {
+void lld::exitLld(int val) {
// Delete any temporary file, while keeping the memory mapping open.
- if (errorHandler().OutputBuffer)
- errorHandler().OutputBuffer->discard();
+ if (errorHandler().outputBuffer)
+ errorHandler().outputBuffer->discard();
// Dealloc/destroy ManagedStatic variables before calling
// _exit(). In a non-LTO build, this is a nop. In an LTO
@@ -57,87 +57,87 @@ void lld::exitLld(int Val) {
outs().flush();
errs().flush();
- _exit(Val);
+ _exit(val);
}
-void lld::diagnosticHandler(const DiagnosticInfo &DI) {
- SmallString<128> S;
- raw_svector_ostream OS(S);
- DiagnosticPrinterRawOStream DP(OS);
- DI.print(DP);
- switch (DI.getSeverity()) {
+void lld::diagnosticHandler(const DiagnosticInfo &di) {
+ SmallString<128> s;
+ raw_svector_ostream os(s);
+ DiagnosticPrinterRawOStream dp(os);
+ di.print(dp);
+ switch (di.getSeverity()) {
case DS_Error:
- error(S);
+ error(s);
break;
case DS_Warning:
- warn(S);
+ warn(s);
break;
case DS_Remark:
case DS_Note:
- message(S);
+ message(s);
break;
}
}
-void lld::checkError(Error E) {
- handleAllErrors(std::move(E),
- [&](ErrorInfoBase &EIB) { error(EIB.message()); });
+void lld::checkError(Error e) {
+ handleAllErrors(std::move(e),
+ [&](ErrorInfoBase &eib) { error(eib.message()); });
}
-void ErrorHandler::print(StringRef S, raw_ostream::Colors C) {
- *ErrorOS << LogName << ": ";
- if (ColorDiagnostics) {
- ErrorOS->changeColor(C, true);
- *ErrorOS << S;
- ErrorOS->resetColor();
+void ErrorHandler::print(StringRef s, raw_ostream::Colors c) {
+ *errorOS << logName << ": ";
+ if (colorDiagnostics) {
+ errorOS->changeColor(c, true);
+ *errorOS << s;
+ errorOS->resetColor();
} else {
- *ErrorOS << S;
+ *errorOS << s;
}
}
-void ErrorHandler::log(const Twine &Msg) {
- if (Verbose) {
- std::lock_guard<std::mutex> Lock(Mu);
- *ErrorOS << LogName << ": " << Msg << "\n";
+void ErrorHandler::log(const Twine &msg) {
+ if (verbose) {
+ std::lock_guard<std::mutex> lock(mu);
+ *errorOS << logName << ": " << msg << "\n";
}
}
-void ErrorHandler::message(const Twine &Msg) {
- std::lock_guard<std::mutex> Lock(Mu);
- outs() << Msg << "\n";
+void ErrorHandler::message(const Twine &msg) {
+ std::lock_guard<std::mutex> lock(mu);
+ outs() << msg << "\n";
outs().flush();
}
-void ErrorHandler::warn(const Twine &Msg) {
- if (FatalWarnings) {
- error(Msg);
+void ErrorHandler::warn(const Twine &msg) {
+ if (fatalWarnings) {
+ error(msg);
return;
}
- std::lock_guard<std::mutex> Lock(Mu);
- newline(ErrorOS, Msg);
+ std::lock_guard<std::mutex> lock(mu);
+ newline(errorOS, msg);
print("warning: ", raw_ostream::MAGENTA);
- *ErrorOS << Msg << "\n";
+ *errorOS << msg << "\n";
}
-void ErrorHandler::error(const Twine &Msg) {
- std::lock_guard<std::mutex> Lock(Mu);
- newline(ErrorOS, Msg);
+void ErrorHandler::error(const Twine &msg) {
+ std::lock_guard<std::mutex> lock(mu);
+ newline(errorOS, msg);
- if (ErrorLimit == 0 || ErrorCount < ErrorLimit) {
+ if (errorLimit == 0 || errorCount < errorLimit) {
print("error: ", raw_ostream::RED);
- *ErrorOS << Msg << "\n";
- } else if (ErrorCount == ErrorLimit) {
+ *errorOS << msg << "\n";
+ } else if (errorCount == errorLimit) {
print("error: ", raw_ostream::RED);
- *ErrorOS << ErrorLimitExceededMsg << "\n";
- if (ExitEarly)
+ *errorOS << errorLimitExceededMsg << "\n";
+ if (exitEarly)
exitLld(1);
}
- ++ErrorCount;
+ ++errorCount;
}
-void ErrorHandler::fatal(const Twine &Msg) {
- error(Msg);
+void ErrorHandler::fatal(const Twine &msg) {
+ error(msg);
exitLld(1);
}
diff --git a/lld/Common/Filesystem.cpp b/lld/Common/Filesystem.cpp
index 6484286f14b..0b47ac7c69c 100644
--- a/lld/Common/Filesystem.cpp
+++ b/lld/Common/Filesystem.cpp
@@ -38,43 +38,43 @@ using namespace lld;
//
// This function spawns a background thread to remove the file.
// The calling thread returns almost immediately.
-void lld::unlinkAsync(StringRef Path) {
+void lld::unlinkAsync(StringRef path) {
// Removing a file is async on windows.
#if defined(_WIN32)
sys::fs::remove(Path);
#else
- if (!ThreadsEnabled || !sys::fs::exists(Path) ||
- !sys::fs::is_regular_file(Path))
+ if (!threadsEnabled || !sys::fs::exists(path) ||
+ !sys::fs::is_regular_file(path))
return;
// We cannot just remove path from a different thread because we are now going
// to create path as a new file.
// Instead we open the file and unlink it on this thread. The unlink is fast
// since the open fd guarantees that it is not removing the last reference.
- int FD;
- std::error_code EC = sys::fs::openFileForRead(Path, FD);
- sys::fs::remove(Path);
+ int fd;
+ std::error_code ec = sys::fs::openFileForRead(path, fd);
+ sys::fs::remove(path);
- if (EC)
+ if (ec)
return;
// close and therefore remove TempPath in background.
- std::mutex M;
- std::condition_variable CV;
- bool Started = false;
- std::thread([&, FD] {
+ std::mutex m;
+ std::condition_variable cv;
+ bool started = false;
+ std::thread([&, fd] {
{
- std::lock_guard<std::mutex> L(M);
- Started = true;
- CV.notify_all();
+ std::lock_guard<std::mutex> l(m);
+ started = true;
+ cv.notify_all();
}
- ::close(FD);
+ ::close(fd);
}).detach();
// GLIBC 2.26 and earlier have race condition that crashes an entire process
// if the main thread calls exit(2) while other thread is starting up.
- std::unique_lock<std::mutex> L(M);
- CV.wait(L, [&] { return Started; });
+ std::unique_lock<std::mutex> l(m);
+ cv.wait(l, [&] { return started; });
#endif
}
@@ -90,10 +90,10 @@ void lld::unlinkAsync(StringRef Path) {
// FileOutputBuffer doesn't touch a desitnation file until commit()
// is called. We use that class without calling commit() to predict
// if the given file is writable.
-std::error_code lld::tryCreateFile(StringRef Path) {
- if (Path.empty())
+std::error_code lld::tryCreateFile(StringRef path) {
+ if (path.empty())
return std::error_code();
- if (Path == "-")
+ if (path == "-")
return std::error_code();
- return errorToErrorCode(FileOutputBuffer::create(Path, 1).takeError());
+ return errorToErrorCode(FileOutputBuffer::create(path, 1).takeError());
}
diff --git a/lld/Common/Memory.cpp b/lld/Common/Memory.cpp
index 5a6ead421ec..c53e1d3e6cf 100644
--- a/lld/Common/Memory.cpp
+++ b/lld/Common/Memory.cpp
@@ -11,12 +11,12 @@
using namespace llvm;
using namespace lld;
-BumpPtrAllocator lld::BAlloc;
-StringSaver lld::Saver{BAlloc};
-std::vector<SpecificAllocBase *> lld::SpecificAllocBase::Instances;
+BumpPtrAllocator lld::bAlloc;
+StringSaver lld::saver{bAlloc};
+std::vector<SpecificAllocBase *> lld::SpecificAllocBase::instances;
void lld::freeArena() {
- for (SpecificAllocBase *Alloc : SpecificAllocBase::Instances)
- Alloc->reset();
- BAlloc.Reset();
+ for (SpecificAllocBase *alloc : SpecificAllocBase::instances)
+ alloc->reset();
+ bAlloc.Reset();
}
diff --git a/lld/Common/Reproduce.cpp b/lld/Common/Reproduce.cpp
index c34a809f401..24210c42041 100644
--- a/lld/Common/Reproduce.cpp
+++ b/lld/Common/Reproduce.cpp
@@ -21,41 +21,41 @@ using namespace llvm::sys;
// assuming that the current directory is "/home/john/bar".
// Returned string is a forward slash separated path even on Windows to avoid
// a mess with backslash-as-escape and backslash-as-path-separator.
-std::string lld::relativeToRoot(StringRef Path) {
- SmallString<128> Abs = Path;
- if (fs::make_absolute(Abs))
- return Path;
- path::remove_dots(Abs, /*remove_dot_dot=*/true);
+std::string lld::relativeToRoot(StringRef path) {
+ SmallString<128> abs = path;
+ if (fs::make_absolute(abs))
+ return path;
+ path::remove_dots(abs, /*remove_dot_dot=*/true);
// This is Windows specific. root_name() returns a drive letter
// (e.g. "c:") or a UNC name (//net). We want to keep it as part
// of the result.
- SmallString<128> Res;
- StringRef Root = path::root_name(Abs);
- if (Root.endswith(":"))
- Res = Root.drop_back();
- else if (Root.startswith("//"))
- Res = Root.substr(2);
+ SmallString<128> res;
+ StringRef root = path::root_name(abs);
+ if (root.endswith(":"))
+ res = root.drop_back();
+ else if (root.startswith("//"))
+ res = root.substr(2);
- path::append(Res, path::relative_path(Abs));
- return path::convert_to_slash(Res);
+ path::append(res, path::relative_path(abs));
+ return path::convert_to_slash(res);
}
// Quote a given string if it contains a space character.
-std::string lld::quote(StringRef S) {
- if (S.contains(' '))
- return ("\"" + S + "\"").str();
- return S;
+std::string lld::quote(StringRef s) {
+ if (s.contains(' '))
+ return ("\"" + s + "\"").str();
+ return s;
}
// Converts an Arg to a string representation suitable for a response file.
// To show an Arg in a diagnostic, use Arg::getAsString() instead.
-std::string lld::toString(const opt::Arg &Arg) {
- std::string K = Arg.getSpelling();
- if (Arg.getNumValues() == 0)
- return K;
- std::string V = quote(Arg.getValue());
- if (Arg.getOption().getRenderStyle() == opt::Option::RenderJoinedStyle)
- return K + V;
- return K + " " + V;
+std::string lld::toString(const opt::Arg &arg) {
+ std::string k = arg.getSpelling();
+ if (arg.getNumValues() == 0)
+ return k;
+ std::string v = quote(arg.getValue());
+ if (arg.getOption().getRenderStyle() == opt::Option::RenderJoinedStyle)
+ return k + v;
+ return k + " " + v;
}
diff --git a/lld/Common/Strings.cpp b/lld/Common/Strings.cpp
index afd5bd39f77..0bf06626cc7 100644
--- a/lld/Common/Strings.cpp
+++ b/lld/Common/Strings.cpp
@@ -19,85 +19,85 @@ using namespace llvm;
using namespace lld;
// Returns the demangled C++ symbol name for Name.
-Optional<std::string> lld::demangleItanium(StringRef Name) {
+Optional<std::string> lld::demangleItanium(StringRef name) {
// itaniumDemangle can be used to demangle strings other than symbol
// names which do not necessarily start with "_Z". Name can be
// either a C or C++ symbol. Don't call itaniumDemangle if the name
// does not look like a C++ symbol name to avoid getting unexpected
// result for a C symbol that happens to match a mangled type name.
- if (!Name.startswith("_Z"))
+ if (!name.startswith("_Z"))
return None;
- char *Buf = itaniumDemangle(Name.str().c_str(), nullptr, nullptr, nullptr);
- if (!Buf)
+ char *buf = itaniumDemangle(name.str().c_str(), nullptr, nullptr, nullptr);
+ if (!buf)
return None;
- std::string S(Buf);
- free(Buf);
- return S;
+ std::string s(buf);
+ free(buf);
+ return s;
}
-Optional<std::string> lld::demangleMSVC(StringRef Name) {
- std::string Prefix;
- if (Name.consume_front("__imp_"))
- Prefix = "__declspec(dllimport) ";
+Optional<std::string> lld::demangleMSVC(StringRef name) {
+ std::string prefix;
+ if (name.consume_front("__imp_"))
+ prefix = "__declspec(dllimport) ";
// Demangle only C++ names.
- if (!Name.startswith("?"))
+ if (!name.startswith("?"))
return None;
- char *Buf = microsoftDemangle(Name.str().c_str(), nullptr, nullptr, nullptr);
- if (!Buf)
+ char *buf = microsoftDemangle(name.str().c_str(), nullptr, nullptr, nullptr);
+ if (!buf)
return None;
- std::string S(Buf);
- free(Buf);
- return Prefix + S;
+ std::string s(buf);
+ free(buf);
+ return prefix + s;
}
-StringMatcher::StringMatcher(ArrayRef<StringRef> Pat) {
- for (StringRef S : Pat) {
- Expected<GlobPattern> Pat = GlobPattern::create(S);
- if (!Pat)
- error(toString(Pat.takeError()));
+StringMatcher::StringMatcher(ArrayRef<StringRef> pat) {
+ for (StringRef s : pat) {
+ Expected<GlobPattern> pat = GlobPattern::create(s);
+ if (!pat)
+ error(toString(pat.takeError()));
else
- Patterns.push_back(*Pat);
+ patterns.push_back(*pat);
}
}
-bool StringMatcher::match(StringRef S) const {
- for (const GlobPattern &Pat : Patterns)
- if (Pat.match(S))
+bool StringMatcher::match(StringRef s) const {
+ for (const GlobPattern &pat : patterns)
+ if (pat.match(s))
return true;
return false;
}
// Converts a hex string (e.g. "deadbeef") to a vector.
-std::vector<uint8_t> lld::parseHex(StringRef S) {
- std::vector<uint8_t> Hex;
- while (!S.empty()) {
- StringRef B = S.substr(0, 2);
- S = S.substr(2);
- uint8_t H;
- if (!to_integer(B, H, 16)) {
- error("not a hexadecimal value: " + B);
+std::vector<uint8_t> lld::parseHex(StringRef s) {
+ std::vector<uint8_t> hex;
+ while (!s.empty()) {
+ StringRef b = s.substr(0, 2);
+ s = s.substr(2);
+ uint8_t h;
+ if (!to_integer(b, h, 16)) {
+ error("not a hexadecimal value: " + b);
return {};
}
- Hex.push_back(H);
+ hex.push_back(h);
}
- return Hex;
+ return hex;
}
// Returns true if S is valid as a C language identifier.
-bool lld::isValidCIdentifier(StringRef S) {
- return !S.empty() && (isAlpha(S[0]) || S[0] == '_') &&
- std::all_of(S.begin() + 1, S.end(),
- [](char C) { return C == '_' || isAlnum(C); });
+bool lld::isValidCIdentifier(StringRef s) {
+ return !s.empty() && (isAlpha(s[0]) || s[0] == '_') &&
+ std::all_of(s.begin() + 1, s.end(),
+ [](char c) { return c == '_' || isAlnum(c); });
}
// Write the contents of the a buffer to a file
-void lld::saveBuffer(StringRef Buffer, const Twine &Path) {
- std::error_code EC;
- raw_fd_ostream OS(Path.str(), EC, sys::fs::OpenFlags::F_None);
- if (EC)
- error("cannot create " + Path + ": " + EC.message());
- OS << Buffer;
+void lld::saveBuffer(StringRef buffer, const Twine &path) {
+ std::error_code ec;
+ raw_fd_ostream os(path.str(), ec, sys::fs::OpenFlags::F_None);
+ if (ec)
+ error("cannot create " + path + ": " + ec.message());
+ os << buffer;
}
diff --git a/lld/Common/Threads.cpp b/lld/Common/Threads.cpp
index 5e0af288263..af04972a376 100644
--- a/lld/Common/Threads.cpp
+++ b/lld/Common/Threads.cpp
@@ -8,4 +8,4 @@
#include "lld/Common/Threads.h"
-bool lld::ThreadsEnabled = true;
+bool lld::threadsEnabled = true;
diff --git a/lld/Common/Timer.cpp b/lld/Common/Timer.cpp
index 30862539c78..4b7d11003b2 100644
--- a/lld/Common/Timer.cpp
+++ b/lld/Common/Timer.cpp
@@ -13,43 +13,43 @@
using namespace lld;
using namespace llvm;
-ScopedTimer::ScopedTimer(Timer &T) : T(&T) { T.start(); }
+ScopedTimer::ScopedTimer(Timer &t) : t(&t) { t.start(); }
void ScopedTimer::stop() {
- if (!T)
+ if (!t)
return;
- T->stop();
- T = nullptr;
+ t->stop();
+ t = nullptr;
}
ScopedTimer::~ScopedTimer() { stop(); }
-Timer::Timer(llvm::StringRef Name) : Name(Name), Parent(nullptr) {}
-Timer::Timer(llvm::StringRef Name, Timer &Parent)
- : Name(Name), Parent(&Parent) {}
+Timer::Timer(llvm::StringRef name) : name(name), parent(nullptr) {}
+Timer::Timer(llvm::StringRef name, Timer &parent)
+ : name(name), parent(&parent) {}
void Timer::start() {
- if (Parent && Total.count() == 0)
- Parent->Children.push_back(this);
- StartTime = std::chrono::high_resolution_clock::now();
+ if (parent && total.count() == 0)
+ parent->children.push_back(this);
+ startTime = std::chrono::high_resolution_clock::now();
}
void Timer::stop() {
- Total += (std::chrono::high_resolution_clock::now() - StartTime);
+ total += (std::chrono::high_resolution_clock::now() - startTime);
}
Timer &Timer::root() {
- static Timer RootTimer("Total Link Time");
- return RootTimer;
+ static Timer rootTimer("Total Link Time");
+ return rootTimer;
}
void Timer::print() {
- double TotalDuration = static_cast<double>(root().millis());
+ double totalDuration = static_cast<double>(root().millis());
// We want to print the grand total under all the intermediate phases, so we
// print all children first, then print the total under that.
- for (const auto &Child : Children)
- Child->print(1, TotalDuration);
+ for (const auto &child : children)
+ child->print(1, totalDuration);
message(std::string(49, '-'));
@@ -58,22 +58,22 @@ void Timer::print() {
double Timer::millis() const {
return std::chrono::duration_cast<std::chrono::duration<double, std::milli>>(
- Total)
+ total)
.count();
}
-void Timer::print(int Depth, double TotalDuration, bool Recurse) const {
- double P = 100.0 * millis() / TotalDuration;
+void Timer::print(int depth, double totalDuration, bool recurse) const {
+ double p = 100.0 * millis() / totalDuration;
- SmallString<32> Str;
- llvm::raw_svector_ostream Stream(Str);
- std::string S = std::string(Depth * 2, ' ') + Name + std::string(":");
- Stream << format("%-30s%5d ms (%5.1f%%)", S.c_str(), (int)millis(), P);
+ SmallString<32> str;
+ llvm::raw_svector_ostream stream(str);
+ std::string s = std::string(depth * 2, ' ') + name + std::string(":");
+ stream << format("%-30s%5d ms (%5.1f%%)", s.c_str(), (int)millis(), p);
- message(Str);
+ message(str);
- if (Recurse) {
- for (const auto &Child : Children)
- Child->print(Depth + 1, TotalDuration);
+ if (recurse) {
+ for (const auto &child : children)
+ child->print(depth + 1, totalDuration);
}
}
OpenPOWER on IntegriCloud