[PATCH] D113715: [mlir][ods] AttrOrTypeGen uses Class

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 17 23:23:58 PST 2021


rriddle added inline comments.


================
Comment at: mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp:1950-1951
 
-  auto properties = method.isStatic() ? Method::MP_Static : Method::MP_None;
-  if (declaration)
-    properties =
-        static_cast<Method::Property>(properties | Method::MP_Declaration);
-  return opClass.addMethod(method.getReturnType(), method.getName(), properties,
+  auto props = (Method::Static & method.isStatic()) |
+               (Method::Declaration & declaration);
+  return opClass.addMethod(method.getReturnType(), method.getName(), props,
----------------
Mogball wrote:
> rriddle wrote:
> > Is this right, AFAICT `Method::Declaration & declaration` is always false.
> This actually expands to `declaration ? Method::Declaration : Method::None`. If that's not intuitive, I can remove it.
Are you implying `Method::Declaration & declaration` is the same as `declaration ? Method::Declaration : Method::None`?

https://godbolt.org/z/rnjhbe77G


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113715/new/

https://reviews.llvm.org/D113715



More information about the llvm-commits mailing list