[PATCH] D81953: [clang-tidy] warnings-as-error no longer exits with ErrorCount

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 16 11:00:14 PDT 2020


njames93 created this revision.
njames93 added reviewers: alexfh, jroelofs, aaron.ballman.
Herald added subscribers: cfe-commits, xazax.hun.
Herald added a project: clang.

When using `-warnings-as-errors`, If there are any warnings promoted to errors, clang-tidy exits with the number of warnings. This really isn't needed and can cause issues when the number of warnings doesn't fit into 8 bits as POSIX terminals aren't designed to handle more than that.
This addresses https://bugs.llvm.org/show_bug.cgi?id=46305.

Bug originally added in D15528 <https://reviews.llvm.org/D15528>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81953

Files:
  clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp


Index: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
===================================================================
--- clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
+++ clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp
@@ -478,7 +478,7 @@
       llvm::errs() << WErrorCount << " warning" << Plural << " treated as error"
                    << Plural << "\n";
     }
-    return WErrorCount;
+    return 1;
   }
 
   if (FoundErrors) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81953.271140.patch
Type: text/x-patch
Size: 456 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200616/49bc0c72/attachment.bin>


More information about the cfe-commits mailing list