diff options
author | Alex Lorenz <arphaman@gmail.com> | 2015-05-21 19:45:02 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2015-05-21 19:45:02 +0000 |
commit | 481dca239365287462520a6c582756280bc742a3 (patch) | |
tree | 0de2cce9e3666f73f90ac4c5777d60241e79f2cc /llvm/lib/Support | |
parent | 374929e1917a4164d01cc64ad989893d29adce47 (diff) | |
download | bcm5719-llvm-481dca239365287462520a6c582756280bc742a3.tar.gz bcm5719-llvm-481dca239365287462520a6c582756280bc742a3.zip |
YAML: Null terminate block scalar's value.
The commit null terminates the string value in the `yaml::BlockScalarNode`
class.
This change is motivated by the initial MIR serialization commit (r237708)
that I reverted in r237730 because the LLVM IR source from the block
scalar node wasn't terminated by a null character and thus the buildbots
failed on one testcase sometimes. This change enables me to recommit
the reverted commit.
llvm-svn: 237942
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/YAMLParser.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp index 41d446744fe..d55da5ef1e4 100644 --- a/llvm/lib/Support/YAMLParser.cpp +++ b/llvm/lib/Support/YAMLParser.cpp @@ -2379,7 +2379,8 @@ parse_property: , T.Range); case Token::TK_BlockScalar: { getNext(); - StringRef StrCopy = StringRef(T.Value).copy(NodeAllocator); + StringRef NullTerminatedStr(T.Value.c_str(), T.Value.length() + 1); + StringRef StrCopy = NullTerminatedStr.copy(NodeAllocator).drop_back(); return new (NodeAllocator) BlockScalarNode(stream.CurrentDoc, AnchorInfo.Range.substr(1), TagInfo.Range, StrCopy, T.Range); |