diff options
| -rw-r--r-- | Log.hh | 5 | ||||
| -rw-r--r-- | main.cc | 2 |
2 files changed, 6 insertions, 1 deletions
@@ -7,6 +7,8 @@ #include <llvm/Support/FormatVariadic.h> #include <llvm/Support/WithColor.h> +#include "Context.hh" + namespace pcc { enum LogLevel { PCC_DEBUG, PCC_INFO, PCC_WARNING, PCC_ERROR }; @@ -18,6 +20,9 @@ const char* GetExecutableName(); template <typename... Args> void Log(LogLevel level, const char* format, Args&&... args) { + if (level < GetLogLevel()) { + return; + } auto msg = llvm::formatv(format, std::forward<Args>(args)...); const char* name = GetExecutableName(); switch (level) { @@ -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; |
