summaryrefslogtreecommitdiffstats
path: root/mlir/lib/IR/FunctionSupport.cpp
diff options
context:
space:
mode:
authorRiver Riddle <riverriddle@google.com>2019-11-05 17:58:16 -0800
committerA. Unique TensorFlower <gardener@tensorflow.org>2019-11-05 17:58:48 -0800
commit8e0f4860cdc07b4c681c434792cede24f16961e3 (patch)
tree0738f42b14d9f8cfce24ae9b5ffcde9a384d772c /mlir/lib/IR/FunctionSupport.cpp
parent500e858e6522c3b55c3f23e95689f146e09db43e (diff)
downloadbcm5719-llvm-8e0f4860cdc07b4c681c434792cede24f16961e3.tar.gz
bcm5719-llvm-8e0f4860cdc07b4c681c434792cede24f16961e3.zip
Add (parse|print)OptionalAttrDictWithKeyword hooks to simplify parsing attribute dictionaries with regions.
Many operations with regions add an additional 'attributes' prefix when printing the attribute dictionary to differentiate it from the region body. This leads to duplicated logic for detecting when to actually print the attribute dictionary. PiperOrigin-RevId: 278747681
Diffstat (limited to 'mlir/lib/IR/FunctionSupport.cpp')
-rw-r--r--mlir/lib/IR/FunctionSupport.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/mlir/lib/IR/FunctionSupport.cpp b/mlir/lib/IR/FunctionSupport.cpp
index aa9965e89d1..d1ba2d30fa1 100644
--- a/mlir/lib/IR/FunctionSupport.cpp
+++ b/mlir/lib/IR/FunctionSupport.cpp
@@ -183,9 +183,8 @@ mlir::impl::parseFunctionLikeOp(OpAsmParser &parser, OperationState &result,
<< (errorMessage.empty() ? "" : ": ") << errorMessage;
// If function attributes are present, parse them.
- if (succeeded(parser.parseOptionalKeyword("attributes")))
- if (parser.parseOptionalAttrDict(result.attributes))
- return failure();
+ if (parser.parseOptionalAttrDictWithKeyword(result.attributes))
+ return failure();
// Add the attributes to the function arguments.
SmallString<8> attrNameBuf;
OpenPOWER on IntegriCloud