[WebAssembly] Tidy up some unneeded newline characters.
authorDan Gohman <dan433584@gmail.com>
Wed, 9 Sep 2015 15:13:36 +0000 (15:13 +0000)
committerDan Gohman <dan433584@gmail.com>
Wed, 9 Sep 2015 15:13:36 +0000 (15:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247152 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp

index c2e71c1489b0ebc7b98f1a69b0b24bd3a51d173c..fca3890de6049c3bdfe0c5aafc5b100dcee2b4c4 100644 (file)
@@ -204,7 +204,7 @@ void WebAssemblyAsmPrinter::EmitGlobalVariable(const GlobalVariable *GV) {
   } else {
     assert(false && "Only integer and floating-point constants are supported");
   }
   } else {
     assert(false && "Only integer and floating-point constants are supported");
   }
-  OS << ") ;; align " << Align << "\n";
+  OS << ") ;; align " << Align;
   OutStreamer->EmitRawText(OS.str());
 }
 
   OutStreamer->EmitRawText(OS.str());
 }
 
@@ -236,19 +236,20 @@ void WebAssemblyAsmPrinter::EmitFunctionBodyStart() {
   SmallString<128> Str;
   raw_svector_ostream OS(Str);
   const Function *F = MF->getFunction();
   SmallString<128> Str;
   raw_svector_ostream OS(Str);
   const Function *F = MF->getFunction();
-  for (const Argument &A : F->args())
-    OS << " (param " << toString(A.getType(), hasAddr64) << ')';
   const Type *Rt = F->getReturnType();
   const Type *Rt = F->getReturnType();
-  if (!Rt->isVoidTy())
-    OS << " (result " << toString(Rt, hasAddr64) << ')';
-  OS << '\n';
-  OutStreamer->EmitRawText(OS.str());
+  if (!Rt->isVoidTy() || !F->arg_empty()) {
+    for (const Argument &A : F->args())
+      OS << " (param " << toString(A.getType(), hasAddr64) << ')';
+    if (!Rt->isVoidTy())
+      OS << " (result " << toString(Rt, hasAddr64) << ')';
+    OutStreamer->EmitRawText(OS.str());
+  }
 }
 
 void WebAssemblyAsmPrinter::EmitFunctionBodyEnd() {
   SmallString<128> Str;
   raw_svector_ostream OS(Str);
 }
 
 void WebAssemblyAsmPrinter::EmitFunctionBodyEnd() {
   SmallString<128> Str;
   raw_svector_ostream OS(Str);
-  OS << ") ;; end func " << toSymbol(CurrentFnSym->getName()) << '\n';
+  OS << ") ;; end func " << toSymbol(CurrentFnSym->getName());
   OutStreamer->EmitRawText(OS.str());
 }
 
   OutStreamer->EmitRawText(OS.str());
 }
 
@@ -299,8 +300,6 @@ void WebAssemblyAsmPrinter::EmitInstruction(const MachineInstr *MI) {
   if (NumDefs != 0)
     OS << ')';
 
   if (NumDefs != 0)
     OS << ')';
 
-  OS << '\n';
-
   OutStreamer->EmitRawText(OS.str());
 }
 
   OutStreamer->EmitRawText(OS.str());
 }