[Mlir-commits] [mlir] [mlir][CAPI][python] bind CallSiteLoc, FileLineColRange, FusedLoc, NameLoc (PR #129351)
Maksim Levental
llvmlistbot at llvm.org
Mon Mar 10 02:04:08 PDT 2025
================
@@ -278,10 +278,64 @@ mlirLocationFileLineColRangeGet(MlirContext context, MlirStringRef filename,
startLine, startCol, endLine, endCol)));
}
+MlirIdentifier mlirLocationFileLineColRangeGetFilename(MlirLocation location) {
+ return wrap(llvm::dyn_cast<FileLineColRange>(unwrap(location)).getFilename());
+}
+
+int mlirLocationFileLineColRangeGetStartLine(MlirLocation location) {
+ if (auto loc = llvm::dyn_cast<FileLineColRange>(unwrap(location)))
+ return loc.getStartLine();
+ return -1;
+}
+
+int mlirLocationFileLineColRangeGetStartColumn(MlirLocation location) {
+ if (auto loc = llvm::dyn_cast<FileLineColRange>(unwrap(location)))
+ return loc.getStartColumn();
+ return -1;
+}
+
+int mlirLocationFileLineColRangeGetEndLine(MlirLocation location) {
+ if (auto loc = llvm::dyn_cast<FileLineColRange>(unwrap(location)))
+ return loc.getEndLine();
+ return -1;
+}
+
+int mlirLocationFileLineColRangeGetEndColumn(MlirLocation location) {
+ if (auto loc = llvm::dyn_cast<FileLineColRange>(unwrap(location)))
+ return loc.getEndColumn();
+ return -1;
+}
+
+MlirTypeID mlirLocationFileLineColRangeGetTypeID() {
----------------
makslevental wrote:
They're not currently but they can be used for value builders (that thing I added a while ago for hooking cpp -> python) so that's why I included those APIs.
https://github.com/llvm/llvm-project/pull/129351
More information about the Mlir-commits
mailing list