diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Module.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/llvm/Module.h b/include/llvm/Module.h index f95895e957..c7063f5e1c 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -211,15 +211,20 @@ public: void setTargetTriple(StringRef T) { TargetTriple = T; } /// Set the module-scope inline assembly blocks. - void setModuleInlineAsm(StringRef Asm) { GlobalScopeAsm = Asm; } + void setModuleInlineAsm(StringRef Asm) { + GlobalScopeAsm = Asm; + if (!GlobalScopeAsm.empty() && + GlobalScopeAsm[GlobalScopeAsm.size()-1] != '\n') + GlobalScopeAsm += '\n'; + } /// Append to the module-scope inline assembly blocks, automatically inserting /// a separating newline if necessary. void appendModuleInlineAsm(StringRef Asm) { + GlobalScopeAsm += Asm; if (!GlobalScopeAsm.empty() && GlobalScopeAsm[GlobalScopeAsm.size()-1] != '\n') GlobalScopeAsm += '\n'; - GlobalScopeAsm += Asm; } /// @} |