diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-07-03 10:15:27 +0100 |
---|---|---|
committer | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-07-03 10:20:00 +0100 |
commit | 3d49da9019ac8a2818d12b5d66264d9e940252ef (patch) | |
tree | 874d52d7c1b2d70181838a2e31a0e1e145498e95 /clang-plugin | |
parent | a76a2c87dc393db260a5bbbeff1caa9660053d18 (diff) |
plugin: Add a --verbose command line option
And only output the version information if that is specified. It’s too
loud otherwise.
Diffstat (limited to 'clang-plugin')
-rw-r--r-- | clang-plugin/plugin.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/clang-plugin/plugin.cpp b/clang-plugin/plugin.cpp index 518a060..1a3954c 100644 --- a/clang-plugin/plugin.cpp +++ b/clang-plugin/plugin.cpp @@ -55,7 +55,11 @@ private: std::make_shared<std::unordered_set<std::string>> (); /* Whether to limit output to only diagnostics. */ - bool _quiet = false; + enum { + VERBOSITY_QUIET, + VERBOSITY_NORMAL, + VERBOSITY_VERBOSE, + }_verbosity = VERBOSITY_NORMAL; protected: /* Note: This is called before ParseArgs, and must transfer ownership @@ -212,7 +216,9 @@ protected: if (arg == "--help") { this->PrintHelp (llvm::outs ()); } else if (arg == "--quiet") { - this->_quiet = true; + this->_verbosity = VERBOSITY_QUIET; + } else if (arg == "--verbose") { + this->_verbosity = VERBOSITY_VERBOSE; } else if (arg == "--enable-checker") { const std::string checker = *(++it); if (checker == "all") { @@ -229,11 +235,11 @@ protected: /* Listen to the V environment variable (as standard in automake) too. */ const char *v_value = getenv ("V"); if (v_value != NULL && strcmp (v_value, "0") == 0) { - this->_quiet = true; + this->_verbosity = VERBOSITY_QUIET; } /* Output a version message. */ - if (!this->_quiet) { + if (this->_verbosity > VERBOSITY_NORMAL) { llvm::outs () << "Tartan version " << VERSION << " " "compiled for LLVM " << LLVM_CONFIG_VERSION << ".\n" << @@ -281,6 +287,8 @@ protected: " Disable all plugin output except code " "diagnostics (remarks,\n" " warnings and errors).\n" + " --verbose\n" + " Output additional versioning information.\n" "\n" "Usage:\n" " clang -cc1 -load /path/to/libtartan.so " |