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
104104 WithPrinter<"writeFileLineColRangeLocs($_writer, $_name)">>>>:$rawLocData
105105)> {
106106 let cBuilder = "getFileLineColRange(context, filename, rawLocData)";
107- let printerPredicate = "!::llvm::isa<FileLineColLoc> ($_val)";
107+ let printerPredicate = "!isStrictFileLineColLoc ($_val)";
108108}
109109
110110def FileLineColLoc : DialectAttribute<(attr
111111 StringAttr:$filename,
112112 VarInt:$start_line,
113113 VarInt:$start_column
114114)> {
115- let printerPredicate = "::llvm::isa<FileLineColLoc> ($_val)";
115+ let printerPredicate = "isStrictFileLineColLoc ($_val)";
116116}
117117}
118118
Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ class FusedLocWith : public FusedLoc {
177177// / column number. This is similar to the type of location that you get from
178178// / most source languages.
179179// /
180- // / FileLineColLoc is a FileLineColRange with exactly one line and column.
180+ // / FileLineColLoc is a view to FileLineColRange with one line and column.
181181class FileLineColLoc : public FileLineColRange {
182182public:
183183 using FileLineColRange::FileLineColRange;
@@ -190,11 +190,12 @@ class FileLineColLoc : public FileLineColRange {
190190 StringAttr getFilename () const ;
191191 unsigned getLine () const ;
192192 unsigned getColumn () const ;
193-
194- // / Methods for support type inquiry through isa, cast, and dyn_cast.
195- static bool classof (Attribute attr);
196193};
197194
195+ // / Returns true iff the given location is a FileLineColRange with exactly one
196+ // / line and column.
197+ bool isStrictFileLineColLoc (Location loc);
198+
198199// ===----------------------------------------------------------------------===//
199200// OpaqueLoc
200201// ===----------------------------------------------------------------------===//
Original file line number Diff line number Diff line change @@ -177,10 +177,8 @@ unsigned FileLineColLoc::getLine() const { return getStartLine(); }
177177
178178unsigned FileLineColLoc::getColumn () const { return getStartColumn (); }
179179
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))
184182 return range.getImpl ()->size () == 2 ;
185183 return false ;
186184}
Original file line number Diff line number Diff line change @@ -115,6 +115,9 @@ llvm.func @func_with_debug(%arg: i64) {
115115 // CHECK: call void @func_no_debug(), !dbg ![[FILE_LOC:[0-9]+]]
116116 llvm.call @func_no_debug () : () -> () loc (" foo.mlir" :1 :2 )
117117
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+
118121 // CHECK: call void @func_no_debug(), !dbg ![[NAMED_LOC:[0-9]+]]
119122 llvm.call @func_no_debug () : () -> () loc (" named" (" foo.mlir" :10 :10 ))
120123
You can’t perform that action at this time.
0 commit comments