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

Maksim Levental llvmlistbot at llvm.org
Fri Apr 17 09:55:02 PDT 2026


================
@@ -143,12 +155,22 @@ class MLIR_PYTHON_API_EXPORTED PyGlobals {
 
     bool isUserTracebackFilename(std::string_view file);
 
+    OnExplicitAction tracebackActionOnExplicitLoc();
+
+    void setTracebackActionOnExplicitLoc(OnExplicitAction action);
+
+    CurrentLocAction tracebackActionOnCurrentLoc();
+
+    void setTracebackActionOnCurrentLoc(CurrentLocAction action);
+
     static constexpr size_t kMaxFrames = 512;
 
   private:
     nanobind::ft_mutex mutex;
     bool locTracebackEnabled_ = false;
     size_t locTracebackFramesLimit_ = 10;
+    OnExplicitAction onExplicitAction_ = OnExplicitAction::UseExplicit;
+    CurrentLocAction currentLocAction_ = CurrentLocAction::Fallback;
----------------
makslevental wrote:

nit: i don't think we use the trailing underscore convention unless there's really a 1-1 collision with an existing name/identifier/something.
```suggestion
    OnExplicitAction onExplicitAction = OnExplicitAction::UseExplicit;
    CurrentLocAction currentLocAction = CurrentLocAction::Fallback;
```

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


More information about the Mlir-commits mailing list