//===- LocationParser.cpp - MLIR Location Parser -------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "Parser.h" #include "Token.h" #include "mlir/IR/Attributes.h" #include "mlir/IR/BuiltinAttributes.h" #include "mlir/IR/Location.h" #include "mlir/Support/LLVM.h" usingnamespacemlir; usingnamespacemlir::detail; /// Specific location instances. /// /// location-inst ::= filelinecol-location | /// name-location | /// callsite-location | /// fused-location | /// unknown-location /// filelinecol-location ::= string-literal ':' integer-literal /// ':' integer-literal /// name-location ::= string-literal /// callsite-location ::= 'callsite' '(' location-inst 'at' location-inst ')' /// fused-location ::= fused ('<' attribute-value '>')? /// '[' location-inst (location-inst ',')* ']' /// unknown-location ::= 'unknown' /// ParseResult Parser::parseCallSiteLocation(LocationAttr &loc) { … } ParseResult Parser::parseFusedLocation(LocationAttr &loc) { … } ParseResult Parser::parseNameOrFileLineColLocation(LocationAttr &loc) { … } ParseResult Parser::parseLocationInstance(LocationAttr &loc) { … }