[dwarfdump] Make incompatibility between -diff and -verbose explicit.

Using -diff and -verbose together doesn't work today. We should audit
where these two options interact and fix them. In the meantime we error
out when the user try to specify both.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@345084 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Jonas Devlieghere 2018-10-23 21:51:44 +00:00
parent f5961147fd
commit ed9fa1afb6
2 changed files with 12 additions and 1 deletions

View File

@ -24,3 +24,6 @@ HELP-NOT: -reverse-iterate
RUN: llvm-dwarfdump --version 2>&1 | FileCheck --check-prefix=VERSION %s
VERSION: {{ version }}
RUN: llvm-dwarfdump -diff -verbose 2>&1 | FileCheck --check-prefix=INCOMPATIBLE %s
INCOMPATIBLE: error: incompatible arguments: specifying both -diff and -verbose is currently not supported

View File

@ -226,7 +226,7 @@ static alias VerboseAlias("v", desc("Alias for -verbose."), aliasopt(Verbose),
static void error(StringRef Prefix, std::error_code EC) {
if (!EC)
return;
errs() << Prefix << ": " << EC.message() << "\n";
WithColor::error() << Prefix << ": " << EC.message() << "\n";
exit(1);
}
@ -571,6 +571,14 @@ int main(int argc, char **argv) {
return 0;
}
// FIXME: Audit interactions between these two options and make them
// compatible.
if (Diff && Verbose) {
WithColor::error() << "incompatible arguments: specifying both -diff and "
"-verbose is currently not supported";
return 0;
}
std::unique_ptr<ToolOutputFile> OutputFile;
if (!OutputFilename.empty()) {
std::error_code EC;