[clang-tools-extra] b6f4834 - [include-cleaner] Fix an unintended early return when checking the

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 27 01:12:54 PST 2023


Author: Haojian Wu
Date: 2023-02-27T10:09:40+01:00
New Revision: b6f48341c5956a5b1d60ceb9963a2a9e5937788d

URL: https://github.com/llvm/llvm-project/commit/b6f48341c5956a5b1d60ceb9963a2a9e5937788d
DIFF: https://github.com/llvm/llvm-project/commit/b6f48341c5956a5b1d60ceb9963a2a9e5937788d.diff

LOG: [include-cleaner] Fix an unintended early return when checking the
incompatible flags in the CLI tool.

Added: 
    

Modified: 
    clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
index f45a54b5ee9a3..918f7c968ef90 100644
--- a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
+++ b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
@@ -187,9 +187,10 @@ int main(int argc, const char **argv) {
   if (OptionsParser->getSourcePathList().size() != 1) {
     std::vector<cl::Option *> IncompatibleFlags = {&HTMLReportPath, &Print};
     for (const auto *Flag : IncompatibleFlags) {
-      if (Flag->getNumOccurrences())
+      if (Flag->getNumOccurrences()) {
         llvm::errs() << "-" << Flag->ArgStr << " requires a single input file";
-      return 1;
+        return 1;
+      }
     }
   }
   auto Factory = clang::tooling::newFrontendActionFactory<Action>();


        


More information about the cfe-commits mailing list