Merge pull request #2554 from hzeller/feature-20260802-update-bant

Update bant to latest.
diff --git a/.bazelrc b/.bazelrc
index 04d1f38..d82019b 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -10,21 +10,18 @@
 build --workspace_status_command="bash bazel/build-version.sh"
 
 # Systems with gcc or clang
-common:unix    --cxxopt=-xc++ --host_cxxopt=-xc++ --cxxopt=-std=c++17 --host_cxxopt=-std=c++17 --client_env=BAZEL_CXXOPTS=-std=c++17
+common:unix    --cxxopt=-xc++      --host_cxxopt=-xc++
+common:unix    --cxxopt=-std=c++20 --host_cxxopt=-std=c++20
 common:linux   --config=unix
 common:freebsd --config=unix --linkopt=-lm --host_linkopt=-lm
 common:openbsd --config=unix --linkopt=-lm --host_linkopt=-lm
 common:macos   --config=unix
 
-# https://github.com/abseil/abseil-cpp/issues/848
-# https://github.com/bazelbuild/bazel/issues/4341#issuecomment-758361769
-common:macos --features=-supports_dynamic_linker --linkopt=-framework --linkopt=CoreFoundation --host_linkopt=-framework --host_linkopt=CoreFoundation
-
 # Use clang-cl by default on Windows. MSVC has some issues with the codebase,
 # so we focus the effort for now is to have a Windows Verible compiled with
 # clang-cl before fixing the issues unique to MSVC.
 common:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows-clang-cl --extra_execution_platforms=//:x64_windows-clang-cl
-common:windows --compiler=clang-cl --cxxopt=/std:c++17 --host_cxxopt=/std:c++17 --client_env=BAZEL_CXXOPTS=/std:c++17
+common:windows --compiler=clang-cl --cxxopt=/std:c++20 --host_cxxopt=/std:c++20 --client_env=BAZEL_CXXOPTS=/std:c++20
 
 build --cxxopt="-Wno-unknown-warning-option" --host_cxxopt="-Wno-unknown-warning-option"
 # TODO: this looks like benign where it happens but to be explored further.
diff --git a/.github/bin/run-format.sh b/.github/bin/run-format.sh
index e6bedd6..3c1c724 100755
--- a/.github/bin/run-format.sh
+++ b/.github/bin/run-format.sh
@@ -47,12 +47,6 @@
 
 BUILDIFIER=${BUILDIFIER:-buildifier}
 
-# Currently, we're using clang-format 17, as newer versions still have some
-# volatility in minor version.
-${CLANG_FORMAT} --version | grep "17\." ||
-  ( echo "-- Need clang-format 17. Currently CLANG_FORMAT=$CLANG_FORMAT --";
-    exit 1)
-
 # Run on all files.
 
 find . -name "*.h" -o -name "*.cc" \
diff --git a/.github/bin/smoke-test.sh b/.github/bin/smoke-test.sh
index ebe5679..ba3ff96 100755
--- a/.github/bin/smoke-test.sh
+++ b/.github/bin/smoke-test.sh
@@ -135,14 +135,14 @@
 
 ExpectedFailCount[syntax:ibex]=13
 ExpectedFailCount[lint:ibex]=13
-ExpectedFailCount[project:ibex]=223
+ExpectedFailCount[project:ibex]=218
 ExpectedFailCount[preprocessor:ibex]=397
 
-ExpectedFailCount[syntax:opentitan]=92
-ExpectedFailCount[lint:opentitan]=92
-ExpectedFailCount[project:opentitan]=1179
+ExpectedFailCount[syntax:opentitan]=88
+ExpectedFailCount[lint:opentitan]=88
+ExpectedFailCount[project:opentitan]=1068
 ExpectedFailCount[formatter:opentitan]=0
-ExpectedFailCount[preprocessor:opentitan]=3061
+ExpectedFailCount[preprocessor:opentitan]=3074
 
 ExpectedFailCount[syntax:sv-tests]=74
 ExpectedFailCount[lint:sv-tests]=73
@@ -151,8 +151,8 @@
 
 ExpectedFailCount[syntax:caliptra-rtl]=39
 ExpectedFailCount[lint:caliptra-rtl]=38
-ExpectedFailCount[project:caliptra-rtl]=455
-ExpectedFailCount[preprocessor:caliptra-rtl]=903
+ExpectedFailCount[project:caliptra-rtl]=453
+ExpectedFailCount[preprocessor:caliptra-rtl]=911
 
 ExpectedFailCount[syntax:Cores-VeeR-EH2]=2
 ExpectedFailCount[lint:Cores-VeeR-EH2]=2
@@ -161,17 +161,17 @@
 
 ExpectedFailCount[syntax:cva6]=7
 ExpectedFailCount[lint:cva6]=7
-ExpectedFailCount[project:cva6]=92
-ExpectedFailCount[preprocessor:cva6]=141
+ExpectedFailCount[project:cva6]=84
+ExpectedFailCount[preprocessor:cva6]=140
 
 ExpectedFailCount[syntax:uvm]=0
 ExpectedFailCount[lint:uvm]=0
-ExpectedFailCount[project:uvm]=47
+ExpectedFailCount[project:uvm]=40
 ExpectedFailCount[preprocessor:uvm]=126
 
 ExpectedFailCount[syntax:tnoc]=3
 ExpectedFailCount[lint:tnoc]=3
-ExpectedFailCount[project:tnoc]=24
+ExpectedFailCount[project:tnoc]=21
 ExpectedFailCount[preprocessor:tnoc]=57
 
 ExpectedFailCount[project:80x86]=2
@@ -187,17 +187,17 @@
 ExpectedFailCount[project:black-parrot]=172
 ExpectedFailCount[preprocessor:black-parrot]=173
 
-ExpectedFailCount[syntax:ivtest]=166
-ExpectedFailCount[lint:ivtest]=166
-ExpectedFailCount[project:ivtest]=198
+ExpectedFailCount[syntax:ivtest]=117
+ExpectedFailCount[lint:ivtest]=117
+ExpectedFailCount[project:ivtest]=146
 ExpectedFailCount[preprocessor:ivtest]=26
 
 ExpectedFailCount[syntax:nontrivial-mips]=2
 ExpectedFailCount[lint:nontrivial-mips]=2
-ExpectedFailCount[project:nontrivial-mips]=81
+ExpectedFailCount[project:nontrivial-mips]=79
 ExpectedFailCount[preprocessor:nontrivial-mips]=78
 
-ExpectedFailCount[project:axi]=82
+ExpectedFailCount[project:axi]=79
 ExpectedFailCount[preprocessor:axi]=79
 
 ExpectedFailCount[syntax:rsd]=5
@@ -205,15 +205,15 @@
 ExpectedFailCount[project:rsd]=52
 ExpectedFailCount[preprocessor:rsd]=49
 
-ExpectedFailCount[project:scr1]=45
+ExpectedFailCount[project:scr1]=44
 ExpectedFailCount[preprocessor:scr1]=46
 
 ExpectedFailCount[project:serv]=1
 ExpectedFailCount[preprocessor:serv]=1
 
-ExpectedFailCount[syntax:basejump_stl]=499
-ExpectedFailCount[lint:basejump_stl]=499
-ExpectedFailCount[project:basejump_stl]=620
+ExpectedFailCount[syntax:basejump_stl]=498
+ExpectedFailCount[lint:basejump_stl]=498
+ExpectedFailCount[project:basejump_stl]=619
 ExpectedFailCount[formatter:basejump_stl]=1
 ExpectedFailCount[preprocessor:basejump_stl]=659
 
diff --git a/.github/settings.sh b/.github/settings.sh
index a6d4ae8..9f56dee 100644
--- a/.github/settings.sh
+++ b/.github/settings.sh
@@ -29,7 +29,7 @@
 
 export GIT_VERSION=${GIT_VERSION:-$(git describe --match='v*')}
 
-export BAZEL_CXXOPTS="-std=c++17"
+export BAZEL_CXXOPTS="-std=c++20"
 
 # Progress output is just noisy in CI outputs.
 export BAZEL_OPTS="-c opt --noshow_progress"
diff --git a/.github/workflows/verible-ci.yml b/.github/workflows/verible-ci.yml
index cd57cd7..62db664 100644
--- a/.github/workflows/verible-ci.yml
+++ b/.github/workflows/verible-ci.yml
@@ -26,7 +26,7 @@
 
 
   CheckFormatAndBuildClean:
-    runs-on: ubuntu-24.04
+    runs-on: ubuntu-latest
     steps:
 
     - name: Checkout code
@@ -36,13 +36,15 @@
 
     - name: Install Dependencies
       run: |
+        sudo apt-get install clang-format-19
+        clang-format-19 --version
         go install github.com/bazelbuild/buildtools/buildifier@latest
         echo "PATH=$PATH:$(go env GOPATH)/bin/" >> $GITHUB_ENV
 
     - name: Run formatting style check
       run: |
         echo "--- check formatting ---"
-        CLANG_FORMAT=clang-format-17 ./.github/bin/run-format.sh --show-diff
+        CLANG_FORMAT=clang-format-19 ./.github/bin/run-format.sh --show-diff
         echo "--- check build dependencies ---"
         ./.github/bin/run-build-cleaner.sh
         echo "--- check potential problems ---"
@@ -124,7 +126,6 @@
         - test
         - test-clang
         - test-nortti
-        - test-c++20
         - test-c++23
         - smoke-test
         #- smoke-test-analyzer  #issue: #2046
@@ -141,8 +142,6 @@
         exclude:
           - mode: test-nortti
             arch: arm64
-          - mode: test-c++20
-            arch: arm64
           - mode: test-c++23
             arch: arm64
           - mode: asan
@@ -182,12 +181,10 @@
         set -x
         apt -qqy update
         apt -qq -y install build-essential wget git python3 python-is-python3 default-jdk cmake python3-pip ripgrep
-        apt -qq -y install gcc-10 g++-10
         apt -qq -y install gcc-14 g++-14
         apt -qq -y install clang-19
         source ./.github/settings.sh
-        # Use newer compiler for c++2x compilation. Also slang needs c++20
-        ./.github/bin/set-compiler.sh $([[ "$MODE" == test-c++2* || "$MODE" == "smoke-test-analyzer" ]] && echo 14 || echo 10)
+        ./.github/bin/set-compiler.sh 14
         ARCH="$ARCH" ./.github/bin/install-bazel.sh
 
     - name: Build Slang
diff --git a/shell.nix b/shell.nix
index 7a8f55e..b616b4f 100644
--- a/shell.nix
+++ b/shell.nix
@@ -37,14 +37,14 @@
       lcov              # coverage html generation.
       bazel-buildtools  # buildifier
 
-      llvmPackages_21.clang-tools    # for clang-tidy
-      llvmPackages_18.clang-tools    # for clang-format
+      llvmPackages_22.clang-tools    # for clang-tidy
+      llvmPackages_19.clang-tools    # for clang-format
     ];
   shellHook = ''
       # clang tidy: use latest.
-      export CLANG_TIDY=${pkgs.llvmPackages_21.clang-tools}/bin/clang-tidy
+      export CLANG_TIDY=${pkgs.llvmPackages_22.clang-tools}/bin/clang-tidy
 
       # Last version that current github CI supports.
-      export CLANG_FORMAT=${pkgs.llvmPackages_18.clang-tools}/bin/clang-format
+      export CLANG_FORMAT=${pkgs.llvmPackages_19.clang-tools}/bin/clang-format
   '';
 }
diff --git a/verible/common/formatting/align.cc b/verible/common/formatting/align.cc
index 9986fc7..74bc432 100644
--- a/verible/common/formatting/align.cc
+++ b/verible/common/formatting/align.cc
@@ -1373,7 +1373,7 @@
         break;
       }
     }  // switch
-  }    // for
+  }  // for
   // Flush out the last range.
   if (match_count >= min_match_count) {
     result.emplace_back(last_range_start, partitions.end(), last_match_subtype);
diff --git a/verible/common/formatting/align_test.cc b/verible/common/formatting/align_test.cc
index d667697..b9bdb47 100644
--- a/verible/common/formatting/align_test.cc
+++ b/verible/common/formatting/align_test.cc
@@ -740,11 +740,12 @@
                                      partition_.Children().end());
 
   const std::vector<TaggedTokenPartitionRange> ranges(
-      GetPartitionAlignmentSubranges(children, [](const TokenPartitionTree
-                                                      &partition) {
-        // Don't care about the subtype tag.
-        return AlignedPartitionClassification{PartitionSelector(partition), 0};
-      }));
+      GetPartitionAlignmentSubranges(children,
+                                     [](const TokenPartitionTree &partition) {
+                                       // Don't care about the subtype tag.
+                                       return AlignedPartitionClassification{
+                                           PartitionSelector(partition), 0};
+                                     }));
 
   using P = std::pair<int, int>;
   std::vector<P> range_indices;
diff --git a/verible/common/text/parser-verifier.h b/verible/common/text/parser-verifier.h
index 08edcb9..90aa0bc 100644
--- a/verible/common/text/parser-verifier.h
+++ b/verible/common/text/parser-verifier.h
@@ -58,7 +58,7 @@
   // TODO(jeremycs): changed these to protected and make SyntaxTreeLeaf
   //                 and SyntaxTreeNode friend classes
   void Visit(const SyntaxTreeLeaf &leaf) final;
-  void Visit(const SyntaxTreeNode &node) final{};
+  void Visit(const SyntaxTreeNode &node) final {};
 
  private:
   const Symbol &root_;
diff --git a/verible/verilog/analysis/checkers/forbid-consecutive-null-statements-rule_test.cc b/verible/verilog/analysis/checkers/forbid-consecutive-null-statements-rule_test.cc
index 83914c6..eb483eb 100644
--- a/verible/verilog/analysis/checkers/forbid-consecutive-null-statements-rule_test.cc
+++ b/verible/verilog/analysis/checkers/forbid-consecutive-null-statements-rule_test.cc
@@ -226,12 +226,12 @@
 
 TEST(ForbidConsecutiveNullStatementsRuleTest, ApplyAutoFix) {
   const std::initializer_list<verible::AutoFixInOut> kTestCases = {
-    {"module m;\ninitial begin ;; end\nendmodule",
-     "module m;\ninitial begin ; end\nendmodule"},
-    {"module m;\ninitial begin ;  ; end\nendmodule",
-     "module m;\ninitial begin ;   end\nendmodule"},
-    {"module m;\ninitial begin ;  /*  */; end\nendmodule",
-     "module m;\ninitial begin ;  /*  */ end\nendmodule"},
+      {"module m;\ninitial begin ;; end\nendmodule",
+       "module m;\ninitial begin ; end\nendmodule"},
+      {"module m;\ninitial begin ;  ; end\nendmodule",
+       "module m;\ninitial begin ;   end\nendmodule"},
+      {"module m;\ninitial begin ;  /*  */; end\nendmodule",
+       "module m;\ninitial begin ;  /*  */ end\nendmodule"},
 #if 0
       // TODO: apply multi-violation fixes in linter_test_utils.
       { "module m;\ninitial begin; ; ; ; end\nendmodule",
diff --git a/verible/verilog/analysis/flow-tree.h b/verible/verilog/analysis/flow-tree.h
index d099bae..33bafa0 100644
--- a/verible/verilog/analysis/flow-tree.h
+++ b/verible/verilog/analysis/flow-tree.h
@@ -77,7 +77,7 @@
   using VariantReceiver = std::function<bool(const Variant &variant)>;
 
   explicit FlowTree(verible::TokenSequence source_sequence)
-      : source_sequence_(std::move(source_sequence)){};
+      : source_sequence_(std::move(source_sequence)) {};
 
   // Generates all possible variants.
   absl::Status GenerateVariants(const VariantReceiver &receiver);
diff --git a/verible/verilog/analysis/verilog-filelist.h b/verible/verilog/analysis/verilog-filelist.h
index 0bb474a..915eb52 100644
--- a/verible/verilog/analysis/verilog-filelist.h
+++ b/verible/verilog/analysis/verilog-filelist.h
@@ -27,7 +27,7 @@
 // TODO(karimtera): Using "MacroDefiniton" struct might be better.
 struct TextMacroDefinition {
   TextMacroDefinition(std::string name, std::string value)
-      : name(std::move(name)), value(std::move(value)){};
+      : name(std::move(name)), value(std::move(value)) {};
   std::string name;
   std::string value;
 
diff --git a/verible/verilog/preprocessor/verilog-preprocess.h b/verible/verilog/preprocessor/verilog-preprocess.h
index 568ed5e..2d134ae 100644
--- a/verible/verilog/preprocessor/verilog-preprocess.h
+++ b/verible/verilog/preprocessor/verilog-preprocess.h
@@ -124,7 +124,7 @@
   // Initialize preprocessing with safe default options
   // TODO(hzeller): remove this constructor once all places using the
   // preprocessor have been updated to pass a config.
-  VerilogPreprocess() : VerilogPreprocess(Config()){};
+  VerilogPreprocess() : VerilogPreprocess(Config()) {};
 
   // ScanStream reads in a stream of tokens returns the result as a move
   // of preprocessor_data_.  preprocessor_data_ should not be accessed
diff --git a/verible/verilog/tools/kythe/kythe-facts.cc b/verible/verilog/tools/kythe/kythe-facts.cc
index 3880d91..948a54e 100644
--- a/verible/verilog/tools/kythe/kythe-facts.cc
+++ b/verible/verilog/tools/kythe/kythe-facts.cc
@@ -154,12 +154,16 @@
     stream << idt << "\"source\": ";
     source_node.FormatJSON(stream, debug, indent_more) << "," << separator;
   }
-  { stream << idt << "\"edge_kind\": \"" << edge_name << "\"," << separator; }
+  {
+    stream << idt << "\"edge_kind\": \"" << edge_name << "\"," << separator;
+  }
   {
     stream << idt << "\"target\": ";
     target_node.FormatJSON(stream, debug, indent_more) << "," << separator;
   }
-  { stream << idt << "\"fact_name\": \"/\"" << separator; }
+  {
+    stream << idt << "\"fact_name\": \"/\"" << separator;
+  }
   return stream << verible::Spacer(indentation) << "}";
 }