[Mlir-commits] [mlir] ac2aaa3 - [mlir][OpInterfaceGen] Emit the utility Trait decl as a class and not using directive

River Riddle llvmlistbot at llvm.org
Thu Apr 30 11:08:19 PDT 2020


Author: River Riddle
Date: 2020-04-30T11:07:58-07:00
New Revision: ac2aaa3788cc5e7e2bd3752ad9f71e37f411bdca

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

LOG: [mlir][OpInterfaceGen] Emit the utility Trait decl as a class and not using directive

This fixes the build on MSVC where it is unable to handle template-template using directives properly.

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 ae86f713c462..a693b0211247 100644
--- a/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpInterfacesGen.cpp
@@ -179,9 +179,10 @@ static void emitTraitDecl(OpInterface &interface, raw_ostream &os,
 
   os << "  };\n";
 
-  // Emit a utility using directive for the trait class.
+  // Emit a utility wrapper trait class.
   os << "    template <typename ConcreteOp>\n    "
-     << llvm::formatv("using Trait = {0}Trait<ConcreteOp>;\n", interfaceName);
+     << llvm::formatv("struct Trait : public {0}Trait<ConcreteOp> {{};\n",
+                      interfaceName);
 }
 
 static void emitInterfaceDecl(OpInterface &interface, raw_ostream &os) {


        


More information about the Mlir-commits mailing list