[Mlir-commits] [mlir] [mlir] Add FileRange location type. (PR #80213)

Mehdi Amini llvmlistbot at llvm.org
Wed Jan 31 17:00:36 PST 2024


================
@@ -102,6 +102,44 @@ def FileLineColLoc : Builtin_LocationAttr<"FileLineColLoc"> {
   let attrName = "builtin.file_line_loc";
 }
 
+//===----------------------------------------------------------------------===//
+// FileRange
+//===----------------------------------------------------------------------===//
+
+def FileRangeLoc : Builtin_LocationAttr<"FileRangeLoc"> {
+  let summary = "A file:line:column to line:column source location range";
+  let description = [{
+    Syntax:
+
+    ```
+    filelinecol-location ::= `range(` string-literal `:` integer-literal `:`
+                             integer-literal ` to ` integer-literal `)`
+    ```
+
+    An instance of this location represents a tuple of file, start line number,
+    start column number, end line, and end column number. This represents a range
+    inside a file.
+  }];
+  let parameters = (ins "StringAttr":$filename, "unsigned":$line,
+                        "unsigned":$column, "unsigned":$byte_size);
+  let builders = [
+    AttrBuilderWithInferredContext<(ins "StringAttr":$filename,
+                                        "unsigned":$line,
+                                        "unsigned":$column,
+                                        "unsigned":$byteSize), [{
----------------
joker-eph wrote:

What about "length" instead of "byteSize"?

https://github.com/llvm/llvm-project/pull/80213


More information about the Mlir-commits mailing list