diff options
| author | River Riddle <riverriddle@google.com> | 2019-11-13 09:31:45 -0800 |
|---|---|---|
| committer | A. Unique TensorFlower <gardener@tensorflow.org> | 2019-11-13 09:32:20 -0800 |
| commit | 6df83699418c6a6d6105728cdec59c78212aa841 (patch) | |
| tree | 7368b187b45efb25e89423a4c8b588aebf24868b /mlir/lib/IR | |
| parent | 85d7fb3324a6442e865c87ea766992ab096f8859 (diff) | |
| download | bcm5719-llvm-6df83699418c6a6d6105728cdec59c78212aa841.tar.gz bcm5719-llvm-6df83699418c6a6d6105728cdec59c78212aa841.zip | |
Rename the current parseSymbolName to parseOptionalSymbolName
The current implementation silently fails if the '@' identifier isn't present, making it similar to the 'optional' parse methods. This change renames the current implementation to 'Optional' and adds a new 'parseSymbolName' that emits an error.
PiperOrigin-RevId: 280214610
Diffstat (limited to 'mlir/lib/IR')
| -rw-r--r-- | mlir/lib/IR/FunctionSupport.cpp | 8 | ||||
| -rw-r--r-- | mlir/lib/IR/Module.cpp | 4 |
2 files changed, 5 insertions, 7 deletions
diff --git a/mlir/lib/IR/FunctionSupport.cpp b/mlir/lib/IR/FunctionSupport.cpp index 29cae177cec..6b27eb833bf 100644 --- a/mlir/lib/IR/FunctionSupport.cpp +++ b/mlir/lib/IR/FunctionSupport.cpp @@ -159,12 +159,10 @@ mlir::impl::parseFunctionLikeOp(OpAsmParser &parser, OperationState &result, auto &builder = parser.getBuilder(); // Parse the name as a symbol reference attribute. - FlatSymbolRefAttr nameAttr; - if (parser.parseAttribute(nameAttr, ::mlir::SymbolTable::getSymbolAttrName(), - result.attributes)) + StringAttr nameAttr; + if (parser.parseSymbolName(nameAttr, ::mlir::SymbolTable::getSymbolAttrName(), + result.attributes)) return failure(); - // Convert the parsed function attr into a string attr. - result.attributes.back().second = builder.getStringAttr(nameAttr.getValue()); // Parse the function signature. auto signatureLocation = parser.getCurrentLocation(); diff --git a/mlir/lib/IR/Module.cpp b/mlir/lib/IR/Module.cpp index f5cc98e39cf..79e04521e9c 100644 --- a/mlir/lib/IR/Module.cpp +++ b/mlir/lib/IR/Module.cpp @@ -44,8 +44,8 @@ ModuleOp ModuleOp::create(Location loc, Optional<StringRef> name) { ParseResult ModuleOp::parse(OpAsmParser &parser, OperationState &result) { // If the name is present, parse it. StringAttr nameAttr; - (void)parser.parseSymbolName(nameAttr, mlir::SymbolTable::getSymbolAttrName(), - result.attributes); + (void)parser.parseOptionalSymbolName( + nameAttr, mlir::SymbolTable::getSymbolAttrName(), result.attributes); // If module attributes are present, parse them. if (parser.parseOptionalAttrDictWithKeyword(result.attributes)) |

