[PATCH] D119422: [flang][NFC] Replace hardcoded attribute name

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 10 02:48:22 PST 2022


clementval created this revision.
clementval added reviewers: jeanPerier, kiranchandramohan, PeteSteinfeld, schweitz, svedanayagam.
Herald added a subscriber: mehdi_amini.
Herald added a project: Flang.
clementval requested review of this revision.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.

Replace the hardcoded attribute name with the constexpr StringRef
defined in the FIROps.td file.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D119422

Files:
  flang/lib/Optimizer/Dialect/FIROps.cpp


Index: flang/lib/Optimizer/Dialect/FIROps.cpp
===================================================================
--- flang/lib/Optimizer/Dialect/FIROps.cpp
+++ flang/lib/Optimizer/Dialect/FIROps.cpp
@@ -603,7 +603,8 @@
   else
     p << op.getOperand(0);
   p << '(' << op->getOperands().drop_front(isDirect ? 0 : 1) << ')';
-  p.printOptionalAttrDict(op->getAttrs(), {"callee"});
+  p.printOptionalAttrDict(op->getAttrs(),
+                          {fir::CallOp::getCalleeAttrNameStr()});
   auto resultTypes{op.getResultTypes()};
   llvm::SmallVector<Type> argTypes(
       llvm::drop_begin(op.getOperandTypes(), isDirect ? 0 : 1));
@@ -620,7 +621,8 @@
   mlir::SymbolRefAttr funcAttr;
   bool isDirect = operands.empty();
   if (isDirect)
-    if (parser.parseAttribute(funcAttr, "callee", attrs))
+    if (parser.parseAttribute(funcAttr, fir::CallOp::getCalleeAttrNameStr(),
+                              attrs))
       return mlir::failure();
 
   Type type;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D119422.407445.patch
Type: text/x-patch
Size: 967 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220210/7a6f5777/attachment.bin>


More information about the llvm-commits mailing list