Tweak the way appendModuleInlineAsm works, so you aren't obliged
[oota-llvm.git] / include / llvm / Module.h
index 3c8055d09fd799c0ad5a7176849a934773394bcf..8dfb5089eadea0d42405716923110c42c30df161 100644 (file)
@@ -211,11 +211,13 @@ public:
   /// Set the module-scope inline assembly blocks.
   void setModuleInlineAsm(StringRef Asm) { GlobalScopeAsm = Asm; }
 
-  /// Append to the module-scope inline assembly blocks, automatically
-  /// appending a newline to the end.
+  /// Append to the module-scope inline assembly blocks, automatically inserting
+  /// a separating newline if necessary.
   void appendModuleInlineAsm(StringRef Asm) {
+    if (!GlobalScopeAsm.empty() &&
+        GlobalScopeAsm[GlobalScopeAsm.size()-1] != '\n')
+      GlobalScopeAsm += '\n';
     GlobalScopeAsm += Asm;
-    GlobalScopeAsm += '\n';
   }
 
 /// @}