File tree Expand file tree Collapse file tree 4 files changed +12
-10
lines changed Expand file tree Collapse file tree 4 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -104,15 +104,15 @@ def FileLineColRange : DialectAttribute<(attr
104
104
WithPrinter<"writeFileLineColRangeLocs($_writer, $_name)">>>>:$rawLocData
105
105
)> {
106
106
let cBuilder = "getFileLineColRange(context, filename, rawLocData)";
107
- let printerPredicate = "!::llvm::isa<FileLineColLoc> ($_val)";
107
+ let printerPredicate = "!isStrictFileLineColLoc ($_val)";
108
108
}
109
109
110
110
def FileLineColLoc : DialectAttribute<(attr
111
111
StringAttr:$filename,
112
112
VarInt:$start_line,
113
113
VarInt:$start_column
114
114
)> {
115
- let printerPredicate = "::llvm::isa<FileLineColLoc> ($_val)";
115
+ let printerPredicate = "isStrictFileLineColLoc ($_val)";
116
116
}
117
117
}
118
118
Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ class FusedLocWith : public FusedLoc {
177
177
// / column number. This is similar to the type of location that you get from
178
178
// / most source languages.
179
179
// /
180
- // / FileLineColLoc is a FileLineColRange with exactly one line and column.
180
+ // / FileLineColLoc is a view to FileLineColRange with one line and column.
181
181
class FileLineColLoc : public FileLineColRange {
182
182
public:
183
183
using FileLineColRange::FileLineColRange;
@@ -190,11 +190,12 @@ class FileLineColLoc : public FileLineColRange {
190
190
StringAttr getFilename () const ;
191
191
unsigned getLine () const ;
192
192
unsigned getColumn () const ;
193
-
194
- // / Methods for support type inquiry through isa, cast, and dyn_cast.
195
- static bool classof (Attribute attr);
196
193
};
197
194
195
+ // / Returns true iff the given location is a FileLineColRange with exactly one
196
+ // / line and column.
197
+ bool isStrictFileLineColLoc (Location loc);
198
+
198
199
// ===----------------------------------------------------------------------===//
199
200
// OpaqueLoc
200
201
// ===----------------------------------------------------------------------===//
Original file line number Diff line number Diff line change @@ -177,10 +177,8 @@ unsigned FileLineColLoc::getLine() const { return getStartLine(); }
177
177
178
178
unsigned FileLineColLoc::getColumn () const { return getStartColumn (); }
179
179
180
- bool FileLineColLoc::classof (Attribute attr) {
181
- // This could also have been for <= 2. But given this is matching previous
182
- // behavior, it is left as is.
183
- if (auto range = mlir::dyn_cast<FileLineColRange>(attr))
180
+ bool mlir::isStrictFileLineColLoc (Location loc) {
181
+ if (auto range = mlir::dyn_cast<FileLineColRange>(loc))
184
182
return range.getImpl ()->size () == 2 ;
185
183
return false ;
186
184
}
Original file line number Diff line number Diff line change @@ -115,6 +115,9 @@ llvm.func @func_with_debug(%arg: i64) {
115
115
// CHECK: call void @func_no_debug(), !dbg ![[FILE_LOC:[0-9]+]]
116
116
llvm.call @func_no_debug () : () -> () loc (" foo.mlir" :1 :2 )
117
117
118
+ // CHECK: call void @func_no_debug(), !dbg ![[FILE_LOC:[0-9]+]]
119
+ llvm.call @func_no_debug () : () -> () loc (" foo.mlir" :1 :2 to 5 :6 )
120
+
118
121
// CHECK: call void @func_no_debug(), !dbg ![[NAMED_LOC:[0-9]+]]
119
122
llvm.call @func_no_debug () : () -> () loc (" named" (" foo.mlir" :10 :10 ))
120
123
You can’t perform that action at this time.
0 commit comments