[llvm] a3095a2 - DebugInfo: Simplify const/volatile printing for function types

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 22 12:20:03 PDT 2022


Author: David Blaikie
Date: 2022-03-22T19:19:54Z
New Revision: a3095a25d036aad8cdf1169647c0d0ec25fd4293

URL: https://github.com/llvm/llvm-project/commit/a3095a25d036aad8cdf1169647c0d0ec25fd4293
DIFF: https://github.com/llvm/llvm-project/commit/a3095a25d036aad8cdf1169647c0d0ec25fd4293.diff

LOG: DebugInfo: Simplify const/volatile printing for function types

Added: 
    

Modified: 
    llvm/lib/DebugInfo/DWARF/DWARFDie.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
index 42c82b1f0809b..6cb9a5a5bd223 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDie.cpp
@@ -638,36 +638,29 @@ struct DWARFTypePrinter {
     if (FirstParamIfArtificial) {
       if (DWARFDie P = FirstParamIfArtificial) {
         if (P.getTag() == DW_TAG_pointer_type) {
-          DWARFDie C;
-          DWARFDie V;
           auto CVStep = [&](DWARFDie CV) {
             if (DWARFDie U = resolveReferencedType(CV)) {
-              if (U.getTag() == DW_TAG_const_type)
-                return C = U;
-              if (U.getTag() == DW_TAG_volatile_type)
-                return V = U;
+              Const |= U.getTag() == DW_TAG_const_type;
+              Volatile |= U.getTag() == DW_TAG_volatile_type;
+              return U;
             }
             return DWARFDie();
           };
           if (DWARFDie CV = CVStep(P)) {
             CVStep(CV);
           }
-          if (C)
-            OS << " const";
-          if (V)
-            OS << " volatile";
         }
       }
-    } else {
-      if (Const)
-        OS << " const";
-      if (Volatile)
-        OS << " volatile";
     }
+    if (Const)
+      OS << " const";
+    if (Volatile)
+      OS << " volatile";
     if (D.find(DW_AT_reference))
       OS << " &";
     if (D.find(DW_AT_rvalue_reference))
       OS << " &&";
+
     appendUnqualifiedNameAfter(Inner, resolveReferencedType(Inner));
   }
   void appendScopes(DWARFDie D) {


        


More information about the llvm-commits mailing list