diff options
author | Duncan Sands <baldrick@free.fr> | 2010-01-26 11:58:04 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2010-01-26 11:58:04 +0000 |
commit | b06f3ad5f99b3ce05a5d39c04cb4d0cbb6d98db4 (patch) | |
tree | 74eefb007e114724785af4213029b49350308d15 /include/llvm/Module.h | |
parent | 871384fcdaafde9341923b280aa277c9f4d4a7a3 (diff) |
Tweak the way appendModuleInlineAsm works, so you aren't obliged
to append a newline when using setModuleInlineAsm in case later
someone calls appendModuleInlineAsm - make newline handling fully
automatic. In case anyone is wondering there is only one user of
appendModuleInlineAsm: the dragonegg plugin.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Module.h')
-rw-r--r-- | include/llvm/Module.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/llvm/Module.h b/include/llvm/Module.h index 3c8055d09f..8dfb5089ea 100644 --- a/include/llvm/Module.h +++ b/include/llvm/Module.h @@ -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'; } /// @} |