[Mlir-commits] [mlir] [mlir][python] Add location source composition to loc_tracebacks() (PR #192310)

Maksim Levental llvmlistbot at llvm.org
Fri Apr 17 10:05:43 PDT 2026


================
@@ -129,6 +129,18 @@ class MLIR_PYTHON_API_EXPORTED PyGlobals {
 
   class MLIR_PYTHON_API_EXPORTED TracebackLoc {
   public:
+    /// Policy for handling explicit loc= when loc_tracebacks() is active.
+    enum class OnExplicitAction : uint8_t {
+      UseExplicit,  // use loc= as base (default)
+      UseTraceback, // discard loc=, generate traceback
+    };
+
+    /// Policy for composing Location.current with the computed location.
+    enum class CurrentLocAction : uint8_t {
+      Fallback,    // use Location.current only as fallback (default)
+      NamelocWrap, // extract NameLoc names, wrap computed loc
----------------
makslevental wrote:

i feel like there are some options missing here - like when there are only two options they're usually opposites right? i guess the other options would involve handling the other kinds of possible locations? `FileLineCol` or whatever? any desire to support those 😄. since the answer is probably no, can you leave a TODO here just so it's clearer that here is where we would add support for those other types.

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


More information about the Mlir-commits mailing list