From d2e985fd323c167e20f77b045a1d99ad166e65db Mon Sep 17 00:00:00 2001 From: rdivacky Date: Wed, 18 Nov 2009 14:58:34 +0000 Subject: Update LLVM to r89205. --- lib/CompilerDriver/Main.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'lib/CompilerDriver/Main.cpp') diff --git a/lib/CompilerDriver/Main.cpp b/lib/CompilerDriver/Main.cpp index c581809..3a3487a 100644 --- a/lib/CompilerDriver/Main.cpp +++ b/lib/CompilerDriver/Main.cpp @@ -19,6 +19,7 @@ #include "llvm/Support/raw_ostream.h" #include "llvm/System/Path.h" +#include #include #include @@ -28,6 +29,8 @@ using namespace llvmc; namespace { + std::stringstream* GlobalTimeLog; + sys::Path getTempDir() { sys::Path tempDir; @@ -81,6 +84,11 @@ namespace { namespace llvmc { +// Used to implement -time option. External linkage is intentional. +void AppendToGlobalTimeLog(const std::string& cmd, double time) { + *GlobalTimeLog << "# " << cmd << ' ' << time << '\n'; +} + // Sometimes plugins want to condition on the value in argv[0]. const char* ProgramName; @@ -122,7 +130,19 @@ int Main(int argc, char** argv) { throw std::runtime_error("no input files"); } - return BuildTargets(graph, langMap); + if (Time) { + GlobalTimeLog = new std::stringstream; + GlobalTimeLog->precision(2); + } + + int ret = BuildTargets(graph, langMap); + + if (Time) { + llvm::errs() << GlobalTimeLog->str(); + delete GlobalTimeLog; + } + + return ret; } catch(llvmc::error_code& ec) { return ec.code(); -- cgit v1.1