[llvm] [RemoveDIs] Print non-intrinsic debug info in textual IR output (PR #79281)

via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 29 03:04:55 PST 2024


================
@@ -234,6 +238,13 @@ class LLVM_EXTERNAL_VISIBILITY Module {
     IsNewDbgInfoFormat = false;
   }
 
+  void setIsNewDbgInfoFormat(bool NewFlag) {
+    if (NewFlag && !IsNewDbgInfoFormat)
+      convertToNewDbgValues();
+    else if (!NewFlag && IsNewDbgInfoFormat)
+      convertFromNewDbgValues();
----------------
phyBrackets wrote:

Ah right, thanks for the explanation, still I think we can make `setIsNewDbgInfoFormat` a bit readable by
```
void setIsNewDbgInfoFormat(bool isNewFormat) {
    if (IsNewFormat == IsNewDbgInfoFormat) {
        return;
    }

    if (IsNewFormat) {
        convertToNewDebugFormat();
    } else {
        convertFromNewDebugFormat();
    }
}
```

Thought an early return make sense in terms of  if the requested format is the same as the current one

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


More information about the llvm-commits mailing list