7878
7979using  namespace  llvm ; 
8080
81- static  const  char  LintAbortOnErrorArgName[] = " lint-abort-on-error" 
82- static  cl::opt<bool >
83-     LintAbortOnError (LintAbortOnErrorArgName, cl::init(false ),
84-                      cl::desc(" In the Lint pass, abort on errors." 
85- 
8681namespace  {
8782namespace  MemRef  {
8883static  const  unsigned  Read = 1 ;
@@ -747,20 +742,26 @@ PreservedAnalyses LintPass::run(Function &F, FunctionAnalysisManager &AM) {
747742  Lint L (Mod, DL, AA, AC, DT, TLI);
748743  L.visit (F);
749744  dbgs () << L.MessagesStr .str ();
750-   if  (LintAbortOnError && !L.MessagesStr .str ().empty ())
751-     report_fatal_error (Twine (" Linter found errors, aborting. (enabled by --" 
752-                            LintAbortOnErrorArgName + " )" 
753-                        false );
745+   if  (AbortOnError && !L.MessagesStr .str ().empty ())
746+     report_fatal_error (
747+         " linter found errors, aborting. (enabled by abort-on-error)" false );
754748  return  PreservedAnalyses::all ();
755749}
756750
751+ void  LintPass::printPipeline (
752+     raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
753+   PassInfoMixin<LintPass>::printPipeline (OS, MapClassName2PassName);
754+   if  (AbortOnError)
755+     OS << " <abort-on-error>" 
756+ }
757+ 
757758// ===----------------------------------------------------------------------===//
758759//   Implement the public interfaces to this file...
759760// ===----------------------------------------------------------------------===//
760761
761762// / lintFunction - Check a function for errors, printing messages on stderr.
762763// /
763- void  llvm::lintFunction (const  Function &f) {
764+ void  llvm::lintFunction (const  Function &f,  bool  AbortOnError ) {
764765  Function &F = const_cast <Function &>(f);
765766  assert (!F.isDeclaration () && " Cannot lint external functions" 
766767
@@ -775,14 +776,14 @@ void llvm::lintFunction(const Function &f) {
775776    AA.registerFunctionAnalysis <TypeBasedAA>();
776777    return  AA;
777778  });
778-   LintPass ().run (F, FAM);
779+   LintPass (AbortOnError ).run (F, FAM);
779780}
780781
781782// / lintModule - Check a module for errors, printing messages on stderr.
782783// /
783- void  llvm::lintModule (const  Module &M) {
784+ void  llvm::lintModule (const  Module &M,  bool  AbortOnError ) {
784785  for  (const  Function &F : M) {
785786    if  (!F.isDeclaration ())
786-       lintFunction (F);
787+       lintFunction (F, AbortOnError );
787788  }
788789}
0 commit comments