summaryrefslogtreecommitdiff
path: root/lib/AsmParser/Parser.cpp
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-06-27 04:33:58 +0000
committerAlp Toker <alp@nuanti.com>2014-06-27 04:33:58 +0000
commitd0996e5b33ede018999044f3c5f05e72540d97c4 (patch)
treec78a4ab783abfeb12368e4dfbf0f3b122ad89fde /lib/AsmParser/Parser.cpp
parent493512898faad01ed17c988f422a644e6fe83264 (diff)
downloadllvm-d0996e5b33ede018999044f3c5f05e72540d97c4.tar.gz
llvm-d0996e5b33ede018999044f3c5f05e72540d97c4.tar.bz2
llvm-d0996e5b33ede018999044f3c5f05e72540d97c4.tar.xz
ParseIR: don't take ownership of the MemoryBuffer
clang was needlessly duplicating whole memory buffer contents in an attempt to satisfy unclear ownership semantics. Let's just hide internal LLVM quirks and present a simple non-owning interface. The public C API preserves previous behaviour for stability. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211861 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/Parser.cpp')
-rw-r--r--lib/AsmParser/Parser.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/AsmParser/Parser.cpp b/lib/AsmParser/Parser.cpp
index 067cac8578..2138fde5eb 100644
--- a/lib/AsmParser/Parser.cpp
+++ b/lib/AsmParser/Parser.cpp
@@ -54,8 +54,7 @@ Module *llvm::ParseAssemblyFile(const std::string &Filename, SMDiagnostic &Err,
Module *llvm::ParseAssemblyString(const char *AsmString, Module *M,
SMDiagnostic &Err, LLVMContext &Context) {
MemoryBuffer *F =
- MemoryBuffer::getMemBuffer(StringRef(AsmString, strlen(AsmString)),
- "<string>");
+ MemoryBuffer::getMemBuffer(StringRef(AsmString), "<string>");
return ParseAssembly(F, M, Err, Context);
}