[Mlir-commits] [mlir] [mlir][nfc] Fix gcc compiler error on destructor in PassRegistry.cpp (PR #187900)

Chris Cotter llvmlistbot at llvm.org
Sat Mar 21 20:54:14 PDT 2026


https://github.com/ccotter updated https://github.com/llvm/llvm-project/pull/187900

>From 22a25674f8a85ad73de6450ad50d844c2d3d1252 Mon Sep 17 00:00:00 2001
From: Chris Cotter <ccotter14 at bloomberg.net>
Date: Sat, 21 Mar 2026 23:19:49 -0400
Subject: [PATCH] [mlir][nfc] Fix gcc compiler error on destructor in
 PassRegistry.cpp

Remove template arguments from out-of-line destructor definition,
as C++20 does not allow template-ids on destructors.
---
 mlir/lib/Pass/PassRegistry.cpp | 36 ++++++++++++++++------------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/mlir/lib/Pass/PassRegistry.cpp b/mlir/lib/Pass/PassRegistry.cpp
index d14d49aac9898..155c5931ff903 100644
--- a/mlir/lib/Pass/PassRegistry.cpp
+++ b/mlir/lib/Pass/PassRegistry.cpp
@@ -419,40 +419,38 @@ size_t detail::PassOptions::getOptionWidth() const {
 // OpPassManager: OptionValue
 //===----------------------------------------------------------------------===//
 
-llvm::cl::OptionValue<OpPassManager>::OptionValue() = default;
-llvm::cl::OptionValue<OpPassManager>::OptionValue(
-    const mlir::OpPassManager &value) {
+namespace llvm::cl {
+
+OptionValue<OpPassManager>::OptionValue() = default;
+OptionValue<OpPassManager>::OptionValue(const mlir::OpPassManager &value) {
   setValue(value);
 }
-llvm::cl::OptionValue<OpPassManager>::OptionValue(
-    const llvm::cl::OptionValue<mlir::OpPassManager> &rhs) {
+OptionValue<OpPassManager>::OptionValue(
+    const OptionValue<mlir::OpPassManager> &rhs) {
   if (rhs.hasValue())
     setValue(rhs.getValue());
 }
-llvm::cl::OptionValue<OpPassManager> &
-llvm::cl::OptionValue<OpPassManager>::operator=(
-    const mlir::OpPassManager &rhs) {
+OptionValue<OpPassManager> &
+OptionValue<OpPassManager>::operator=(const mlir::OpPassManager &rhs) {
   setValue(rhs);
   return *this;
 }
 
-llvm::cl::OptionValue<OpPassManager>::~OptionValue<OpPassManager>() = default;
+OptionValue<OpPassManager>::~OptionValue() = default;
 
-void llvm::cl::OptionValue<OpPassManager>::setValue(
-    const OpPassManager &newValue) {
+void OptionValue<OpPassManager>::setValue(const OpPassManager &newValue) {
   if (hasValue())
     *value = newValue;
   else
     value = std::make_unique<mlir::OpPassManager>(newValue);
 }
-void llvm::cl::OptionValue<OpPassManager>::setValue(StringRef pipelineStr) {
+void OptionValue<OpPassManager>::setValue(StringRef pipelineStr) {
   FailureOr<OpPassManager> pipeline = parsePassPipeline(pipelineStr);
   assert(succeeded(pipeline) && "invalid pass pipeline");
   setValue(*pipeline);
 }
 
-bool llvm::cl::OptionValue<OpPassManager>::compare(
-    const mlir::OpPassManager &rhs) const {
+bool OptionValue<OpPassManager>::compare(const mlir::OpPassManager &rhs) const {
   std::string lhsStr, rhsStr;
   {
     raw_string_ostream lhsStream(lhsStr);
@@ -466,17 +464,17 @@ bool llvm::cl::OptionValue<OpPassManager>::compare(
   return lhsStr == rhsStr;
 }
 
-void llvm::cl::OptionValue<OpPassManager>::anchor() {}
+void OptionValue<OpPassManager>::anchor() {}
+
+} // namespace llvm::cl
 
 //===----------------------------------------------------------------------===//
 // OpPassManager: Parser
 //===----------------------------------------------------------------------===//
 
-namespace llvm {
-namespace cl {
+namespace llvm::cl {
 template class basic_parser<OpPassManager>;
-} // namespace cl
-} // namespace llvm
+} // namespace llvm::cl
 
 bool llvm::cl::parser<OpPassManager>::parse(Option &, StringRef, StringRef arg,
                                             ParsedPassManager &value) {



More information about the Mlir-commits mailing list