[Mlir-commits] [mlir] 8ed8855 - [mlir] ODS: do not emit trailing const for static methods

Alex Zinenko llvmlistbot at llvm.org
Tue Jun 15 04:33:46 PDT 2021


Author: Alex Zinenko
Date: 2021-06-15T13:33:39+02:00
New Revision: 8ed88559582fd8f0e8a148cc7220619753cfb287

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

LOG: [mlir] ODS: do not emit trailing const for static methods

The generated C++ would be invalid.

Reviewed By: rriddle

Differential Revision: https://reviews.llvm.org/D104233

Added: 
    

Modified: 
    mlir/tools/mlir-tblgen/OpInterfacesGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp b/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
index d7692d2b6f5e..11531957b955 100644
--- a/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
@@ -325,7 +325,7 @@ void InterfaceGenerator::emitTraitDecl(Interface &interface,
     os << "    " << (method.isStatic() ? "static " : "");
     emitCPPType(method.getReturnType(), os);
     emitMethodNameAndArgs(method, os, valueType, /*addThisArg=*/false,
-                          /*addConst=*/!isOpInterface);
+                          /*addConst=*/!isOpInterface && !method.isStatic());
     os << " {\n      " << tblgen::tgfmt(defaultImpl->trim(), &traitMethodFmt)
        << "\n    }\n";
   }


        


More information about the Mlir-commits mailing list