From 1e993f800921d2a49ad0c71375512a9209347321 Mon Sep 17 00:00:00 2001 From: Nagi5Yeq Date: Mon, 1 Jun 2020 12:12:59 +0800 Subject: fix log stuff --- Log.hh | 5 +++++ main.cc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Log.hh b/Log.hh index 561ccf2..0656fa6 100644 --- a/Log.hh +++ b/Log.hh @@ -7,6 +7,8 @@ #include #include +#include "Context.hh" + namespace pcc { enum LogLevel { PCC_DEBUG, PCC_INFO, PCC_WARNING, PCC_ERROR }; @@ -18,6 +20,9 @@ const char* GetExecutableName(); template void Log(LogLevel level, const char* format, Args&&... args) { + if (level < GetLogLevel()) { + return; + } auto msg = llvm::formatv(format, std::forward(args)...); const char* name = GetExecutableName(); switch (level) { diff --git a/main.cc b/main.cc index da938a8..5613a15 100644 --- a/main.cc +++ b/main.cc @@ -21,7 +21,7 @@ void compile(llvm::Module* module, llvm::raw_pwrite_stream& output, int main(int argc, char* argv[]) { int rv; - int level = pcc::ToUnderlying(pcc::PCC_WARNING); + int level = pcc::PCC_WARNING; std::string OutputFileName; enum { IR, ASSEMBLY, OBJECT } CompileType = IR; int OptLevel = 2; -- cgit