[llvm] d65a3b3 - Fix build issue in assert mode introduced by 6427f4c52c31cc36004

via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 25 13:27:37 PST 2022


Author: serge-sans-paille
Date: 2022-01-25T22:27:26+01:00
New Revision: d65a3b3265d058ce1f0ac82fa4d0826bf1b2bbaf

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

LOG: Fix build issue in assert mode introduced by 6427f4c52c31cc36004

After 6427f4c52c31cc36004, one should use SortedCategories to check category
validity.

Added: 
    

Modified: 
    llvm/lib/Support/CommandLine.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp
index e517ceb05d9b..c61e3c00737a 100644
--- a/llvm/lib/Support/CommandLine.cpp
+++ b/llvm/lib/Support/CommandLine.cpp
@@ -2356,7 +2356,9 @@ class CategorizedHelpPrinter : public HelpPrinter {
     for (size_t I = 0, E = Opts.size(); I != E; ++I) {
       Option *Opt = Opts[I].second;
       for (auto &Cat : Opt->Categories) {
-        assert(CategorizedOptions.count(Cat) > 0 &&
+        assert(std::binary_search(SortedCategories.begin(),
+                                  SortedCategories.end(), Cat,
+                                  OptionCategoryCompare) &&
                "Option has an unregistered category");
         CategorizedOptions[Cat].push_back(Opt);
       }


        


More information about the llvm-commits mailing list