[opt] Remove obsolete --quiet option

git blame shows these were last touched in 2004?
 Obsoleted in r13844.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D83409
This commit is contained in:
Arthur Eubanks 2020-07-08 13:20:34 -07:00
parent 6e089e98a9
commit 930eaadacf
8 changed files with 50 additions and 81 deletions

View File

@ -15,17 +15,16 @@
#define LLVM_SUPPORT_SYSTEMUTILS_H
namespace llvm {
class raw_ostream;
class raw_ostream;
/// Determine if the raw_ostream provided is connected to a terminal. If so,
/// generate a warning message to errs() advising against display of bitcode
/// and return true. Otherwise just return false.
/// Check for output written to a console
bool CheckBitcodeOutputToConsole(
raw_ostream &stream_to_check, ///< The stream to be checked
bool print_warning = true ///< Control whether warnings are printed
raw_ostream &stream_to_check ///< The stream to be checked
);
} // End llvm namespace
} // namespace llvm
#endif

View File

@ -15,15 +15,12 @@
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
bool llvm::CheckBitcodeOutputToConsole(raw_ostream &stream_to_check,
bool print_warning) {
bool llvm::CheckBitcodeOutputToConsole(raw_ostream &stream_to_check) {
if (stream_to_check.is_displayed()) {
if (print_warning) {
errs() << "WARNING: You're attempting to print out a bitcode file.\n"
"This is inadvisable as it may cause display problems. If\n"
"you REALLY want to taste LLVM bitcode first-hand, you\n"
"can force output with the `-f' option.\n\n";
}
errs() << "WARNING: You're attempting to print out a bitcode file.\n"
"This is inadvisable as it may cause display problems. If\n"
"you REALLY want to taste LLVM bitcode first-hand, you\n"
"can force output with the `-f' option.\n\n";
return true;
}
return false;

View File

@ -88,7 +88,7 @@ static void WriteOutputFile(const Module *M, const ModuleSummaryIndex *Index) {
exit(1);
}
if (Force || !CheckBitcodeOutputToConsole(Out->os(), true)) {
if (Force || !CheckBitcodeOutputToConsole(Out->os())) {
const ModuleSummaryIndex *IndexToWrite = nullptr;
// Don't attempt to write a summary index unless it contains any entries or
// has non-zero flags. The latter is used to assemble dummy index files for

View File

@ -381,7 +381,7 @@ int main(int argc, char **argv) {
if (OutputAssembly)
Passes.add(
createPrintModulePass(Out.os(), "", PreserveAssemblyUseListOrder));
else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
else if (Force || !CheckBitcodeOutputToConsole(Out.os()))
Passes.add(createBitcodeWriterPass(Out.os(), PreserveBitcodeUseListOrder));
Passes.run(*M.get());

View File

@ -399,7 +399,7 @@ int main(int argc, char **argv) {
errs() << "Writing bitcode...\n";
if (OutputAssembly) {
Composite->print(Out.os(), nullptr, PreserveAssemblyUseListOrder);
} else if (Force || !CheckBitcodeOutputToConsole(Out.os(), true))
} else if (Force || !CheckBitcodeOutputToConsole(Out.os()))
WriteBitcodeToFile(*Composite, Out.os(), PreserveBitcodeUseListOrder);
// Declare success.

View File

@ -33,18 +33,16 @@ struct FunctionPassPrinter : public FunctionPass {
raw_ostream &Out;
static char ID;
std::string PassName;
bool QuietPass;
FunctionPassPrinter(const PassInfo *PI, raw_ostream &out, bool Quiet)
: FunctionPass(ID), PassToPrint(PI), Out(out), QuietPass(Quiet) {
FunctionPassPrinter(const PassInfo *PI, raw_ostream &out)
: FunctionPass(ID), PassToPrint(PI), Out(out) {
std::string PassToPrintName = std::string(PassToPrint->getPassName());
PassName = "FunctionPass Printer: " + PassToPrintName;
}
bool runOnFunction(Function &F) override {
if (!QuietPass)
Out << "Printing analysis '" << PassToPrint->getPassName()
<< "' for function '" << F.getName() << "':\n";
Out << "Printing analysis '" << PassToPrint->getPassName()
<< "' for function '" << F.getName() << "':\n";
// Get and print pass...
getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(Out, F.getParent());
@ -66,17 +64,15 @@ struct CallGraphSCCPassPrinter : public CallGraphSCCPass {
const PassInfo *PassToPrint;
raw_ostream &Out;
std::string PassName;
bool QuietPass;
CallGraphSCCPassPrinter(const PassInfo *PI, raw_ostream &out, bool Quiet)
: CallGraphSCCPass(ID), PassToPrint(PI), Out(out), QuietPass(Quiet) {
CallGraphSCCPassPrinter(const PassInfo *PI, raw_ostream &out)
: CallGraphSCCPass(ID), PassToPrint(PI), Out(out) {
std::string PassToPrintName = std::string(PassToPrint->getPassName());
PassName = "CallGraphSCCPass Printer: " + PassToPrintName;
}
bool runOnSCC(CallGraphSCC &SCC) override {
if (!QuietPass)
Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
// Get and print pass...
for (CallGraphSCC::iterator I = SCC.begin(), E = SCC.end(); I != E; ++I) {
@ -103,17 +99,15 @@ struct ModulePassPrinter : public ModulePass {
const PassInfo *PassToPrint;
raw_ostream &Out;
std::string PassName;
bool QuietPass;
ModulePassPrinter(const PassInfo *PI, raw_ostream &out, bool Quiet)
: ModulePass(ID), PassToPrint(PI), Out(out), QuietPass(Quiet) {
ModulePassPrinter(const PassInfo *PI, raw_ostream &out)
: ModulePass(ID), PassToPrint(PI), Out(out) {
std::string PassToPrintName = std::string(PassToPrint->getPassName());
PassName = "ModulePass Printer: " + PassToPrintName;
}
bool runOnModule(Module &M) override {
if (!QuietPass)
Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
// Get and print pass...
getAnalysisID<Pass>(PassToPrint->getTypeInfo()).print(Out, &M);
@ -135,17 +129,15 @@ struct LoopPassPrinter : public LoopPass {
const PassInfo *PassToPrint;
raw_ostream &Out;
std::string PassName;
bool QuietPass;
LoopPassPrinter(const PassInfo *PI, raw_ostream &out, bool Quiet)
: LoopPass(ID), PassToPrint(PI), Out(out), QuietPass(Quiet) {
LoopPassPrinter(const PassInfo *PI, raw_ostream &out)
: LoopPass(ID), PassToPrint(PI), Out(out) {
std::string PassToPrintName = std::string(PassToPrint->getPassName());
PassName = "LoopPass Printer: " + PassToPrintName;
}
bool runOnLoop(Loop *L, LPPassManager &LPM) override {
if (!QuietPass)
Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
Out << "Printing analysis '" << PassToPrint->getPassName() << "':\n";
// Get and print pass...
getAnalysisID<Pass>(PassToPrint->getTypeInfo())
@ -168,20 +160,17 @@ struct RegionPassPrinter : public RegionPass {
const PassInfo *PassToPrint;
raw_ostream &Out;
std::string PassName;
bool QuietPass;
RegionPassPrinter(const PassInfo *PI, raw_ostream &out, bool Quiet)
: RegionPass(ID), PassToPrint(PI), Out(out), QuietPass(Quiet) {
RegionPassPrinter(const PassInfo *PI, raw_ostream &out)
: RegionPass(ID), PassToPrint(PI), Out(out) {
std::string PassToPrintName = std::string(PassToPrint->getPassName());
PassName = "RegionPass Printer: " + PassToPrintName;
}
bool runOnRegion(Region *R, RGPassManager &RGM) override {
if (!QuietPass) {
Out << "Printing analysis '" << PassToPrint->getPassName() << "' for "
<< "region: '" << R->getNameStr() << "' in function '"
<< R->getEntry()->getParent()->getName() << "':\n";
}
Out << "Printing analysis '" << PassToPrint->getPassName() << "' for "
<< "region: '" << R->getNameStr() << "' in function '"
<< R->getEntry()->getParent()->getName() << "':\n";
// Get and print pass...
getAnalysisID<Pass>(PassToPrint->getTypeInfo())
.print(Out, R->getEntry()->getParent()->getParent());
@ -201,28 +190,23 @@ char RegionPassPrinter::ID = 0;
} // end anonymous namespace
FunctionPass *llvm::createFunctionPassPrinter(const PassInfo *PI,
raw_ostream &OS, bool Quiet) {
return new FunctionPassPrinter(PI, OS, Quiet);
raw_ostream &OS) {
return new FunctionPassPrinter(PI, OS);
}
CallGraphSCCPass *llvm::createCallGraphPassPrinter(const PassInfo *PI,
raw_ostream &OS,
bool Quiet) {
return new CallGraphSCCPassPrinter(PI, OS, Quiet);
raw_ostream &OS) {
return new CallGraphSCCPassPrinter(PI, OS);
}
ModulePass *llvm::createModulePassPrinter(const PassInfo *PI, raw_ostream &OS,
bool Quiet) {
return new ModulePassPrinter(PI, OS, Quiet);
ModulePass *llvm::createModulePassPrinter(const PassInfo *PI, raw_ostream &OS) {
return new ModulePassPrinter(PI, OS);
}
LoopPass *llvm::createLoopPassPrinter(const PassInfo *PI, raw_ostream &OS,
bool Quiet) {
return new LoopPassPrinter(PI, OS, Quiet);
LoopPass *llvm::createLoopPassPrinter(const PassInfo *PI, raw_ostream &OS) {
return new LoopPassPrinter(PI, OS);
}
RegionPass *llvm::createRegionPassPrinter(const PassInfo *PI, raw_ostream &OS,
bool Quiet) {
return new RegionPassPrinter(PI, OS, Quiet);
RegionPass *llvm::createRegionPassPrinter(const PassInfo *PI, raw_ostream &OS) {
return new RegionPassPrinter(PI, OS);
}

View File

@ -24,20 +24,16 @@ class PassInfo;
class raw_ostream;
class RegionPass;
FunctionPass *createFunctionPassPrinter(const PassInfo *PI, raw_ostream &out,
bool Quiet);
FunctionPass *createFunctionPassPrinter(const PassInfo *PI, raw_ostream &out);
CallGraphSCCPass *createCallGraphPassPrinter(const PassInfo *PI,
raw_ostream &out, bool Quiet);
raw_ostream &out);
ModulePass *createModulePassPrinter(const PassInfo *PI, raw_ostream &out,
bool Quiet);
ModulePass *createModulePassPrinter(const PassInfo *PI, raw_ostream &out);
LoopPass *createLoopPassPrinter(const PassInfo *PI, raw_ostream &out,
bool Quiet);
LoopPass *createLoopPassPrinter(const PassInfo *PI, raw_ostream &out);
RegionPass *createRegionPassPrinter(const PassInfo *PI, raw_ostream &out,
bool Quiet);
RegionPass *createRegionPassPrinter(const PassInfo *PI, raw_ostream &out);
} // end namespace llvm

View File

@ -203,13 +203,6 @@ DisableBuiltins("disable-builtin",
cl::desc("Disable specific target library builtin function"),
cl::ZeroOrMore);
static cl::opt<bool>
Quiet("q", cl::desc("Obsolete option"), cl::Hidden);
static cl::alias
QuietA("quiet", cl::desc("Alias for -q"), cl::aliasopt(Quiet));
static cl::opt<bool>
AnalyzeOnly("analyze", cl::desc("Only perform analysis, no optimization"));
@ -730,7 +723,7 @@ int main(int argc, char **argv) {
// console, print out a warning message and refuse to do it. We don't
// impress anyone by spewing tons of binary goo to a terminal.
if (!Force && !NoOutput && !AnalyzeOnly && !OutputAssembly)
if (CheckBitcodeOutputToConsole(Out->os(), !Quiet))
if (CheckBitcodeOutputToConsole(Out->os()))
NoOutput = true;
if (OutputThinLTOBC)
@ -900,19 +893,19 @@ int main(int argc, char **argv) {
if (AnalyzeOnly) {
switch (Kind) {
case PT_Region:
Passes.add(createRegionPassPrinter(PassInf, Out->os(), Quiet));
Passes.add(createRegionPassPrinter(PassInf, Out->os()));
break;
case PT_Loop:
Passes.add(createLoopPassPrinter(PassInf, Out->os(), Quiet));
Passes.add(createLoopPassPrinter(PassInf, Out->os()));
break;
case PT_Function:
Passes.add(createFunctionPassPrinter(PassInf, Out->os(), Quiet));
Passes.add(createFunctionPassPrinter(PassInf, Out->os()));
break;
case PT_CallGraphSCC:
Passes.add(createCallGraphPassPrinter(PassInf, Out->os(), Quiet));
Passes.add(createCallGraphPassPrinter(PassInf, Out->os()));
break;
default:
Passes.add(createModulePassPrinter(PassInf, Out->os(), Quiet));
Passes.add(createModulePassPrinter(PassInf, Out->os()));
break;
}
}