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

via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 27 15:21:39 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:

That looks a bit less readable to me, would it be better to change to this?
```
 if (IsNewFormat != IsNewDbgInfoFormat) {
        if (IsNewFormat) {
            convertToNewDebugFormat();
        } else {
            convertFromNewDebugFormat();
        }
     IsNewDbgInfoFormat = IsNewFormat;
   }
```
 `IsNewDbgInfoFormat = IsNewFormat;` // would be nice 
 We can then refactor/remove the `IsNewDbgInfoFormat = true/false` from `convertToNewDebugFormat()` and  `convertFromNewDbgValues()` and just keep this line in `setIsNewDbgInfoFormat` and then the method name also makes a bit more sense in terms of really "setting" the new debug format 😉 

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


More information about the llvm-commits mailing list