aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/ADT/Twine.h
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-01 20:37:30 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-01 20:37:30 +0000
commit7dc7ac3cb20b7ef8e6febe0ac3bc430230f29893 (patch)
tree8f8f6241c8d337970dc397842482c4279e1ea9c0 /include/llvm/ADT/Twine.h
parentf00140c8e16936aac3f51cc5607168f6982a987a (diff)
downloadexternal_llvm-7dc7ac3cb20b7ef8e6febe0ac3bc430230f29893.zip
external_llvm-7dc7ac3cb20b7ef8e6febe0ac3bc430230f29893.tar.gz
external_llvm-7dc7ac3cb20b7ef8e6febe0ac3bc430230f29893.tar.bz2
Support/ADT/Twine: Add toNullTerminatedStringRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120600 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/Twine.h')
-rw-r--r--include/llvm/ADT/Twine.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/llvm/ADT/Twine.h b/include/llvm/ADT/Twine.h
index 82f46c9..ab8d365 100644
--- a/include/llvm/ADT/Twine.h
+++ b/include/llvm/ADT/Twine.h
@@ -382,6 +382,14 @@ namespace llvm {
/// SmallVector and a StringRef to the SmallVector's data is returned.
StringRef toStringRef(SmallVectorImpl<char> &Out) const;
+ /// toNullTerminatedStringRef - This returns the twine as a single null
+ /// terminated StringRef if it can be represented as such. Otherwise the
+ /// twine is written into the given SmallVector and a StringRef to the
+ /// SmallVector's data is returned.
+ ///
+ /// The returned StringRef's size does not include the null terminator.
+ StringRef toNullTerminatedStringRef(SmallVectorImpl<char> &Out) const;
+
/// print - Write the concatenated string represented by this twine to the
/// stream \arg OS.
void print(raw_ostream &OS) const;