[Mlir-commits] [llvm] [mlir] eliminating g++ warnings (PR #105520)

Frank Schlimbach llvmlistbot at llvm.org
Thu Aug 22 01:39:00 PDT 2024


================
@@ -94,6 +94,7 @@ class Pass {
     Option(Pass &parent, StringRef arg, Args &&...args)
         : detail::PassOptions::Option<DataType, OptionParser>(
               parent.passOptions, arg, std::forward<Args>(args)...) {}
+    Option &operator=(const Option &other) = default; // gcc11
----------------
fschlimb wrote:

This gets triggered by `g++-11 -Wdeprecated-copy`.
Here's the message:
```
llvm-project/mlir/test/lib/Analysis/DataFlow/TestDenseBackwardDataFlowAnalysis.cpp: In copy constructor ‘{anonymous}::TestNextAccessPass::TestNextAccessPass(const {anonymous}::TestNextAccessPass&)’:
llvm-project/mlir/test/lib/Analysis/DataFlow/TestDenseBackwardDataFlowAnalysis.cpp:194:29: warning: implicitly-declared ‘mlir::Pass::Option<bool>& mlir::Pass::Option<bool>::operator=(const mlir::Pass::Option<bool>&)’ is deprecated [-Wdeprecated-copy]
  194 |     interprocedural = other.interprocedural;
      |                             ^~~~~~~~~~~~~~~
In file included from llvm-project/mlir/include/mlir/Pass/PassRegistry.h:17,
                 from llvm-project/mlir/include/mlir/Pass/Pass.h:14,
                 from llvm-project/mlir/test/lib/Analysis/DataFlow/TestDenseBackwardDataFlowAnalysis.cpp:25:
llvm-project/mlir/include/mlir/Pass/PassOptions.h:213:13: note: because ‘mlir::Pass::Option<bool>’ has user-provided ‘mlir::detail::PassOptions::Option<DataType, OptionParser>& mlir::detail::PassOptions::Option<DataType, OptionParser>::operator=(const mlir::detail::PassOptions::Option<DataType, OptionParser>&) [with DataType = bool; OptionParser = llvm::cl::parser<bool>]’
  213 |     Option &operator=(const Option &other) {
  ```

g++-12 does not report this. I am not entirely sure, but this might actually be a false-positive in g++-11.

https://github.com/llvm/llvm-project/pull/105520


More information about the Mlir-commits mailing list