Avoid a spurious extra space character when printing empty structs.
authorDan Gohman <gohman@apple.com>
Thu, 25 Sep 2008 17:37:20 +0000 (17:37 +0000)
committerDan Gohman <gohman@apple.com>
Thu, 25 Sep 2008 17:37:20 +0000 (17:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56616 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AsmWriter.cpp

index 6cdf72527bfb3df22e6dc55938c718d95fad38a8..1fb229be33c6da6787d0c4ca28688578e98a1cf1 100644 (file)
@@ -532,11 +532,12 @@ static void calcTypeName(const Type *Ty,
     Result += "{ ";
     for (StructType::element_iterator I = STy->element_begin(),
            E = STy->element_end(); I != E; ++I) {
-      if (I != STy->element_begin())
-        Result += ", ";
       calcTypeName(*I, TypeStack, TypeNames, Result);
+      if (next(I) != STy->element_end())
+        Result += ',';
+      Result += ' ';
     }
-    Result += " }";
+    Result += '}';
     if (STy->isPacked())
       Result += '>';
     break;