From bf9a3148af6b66b4c693bcc4e2fbf3cba94cbcb1 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 29 Oct 2001 13:24:31 +0000 Subject: [PATCH] Include functionality to get a string array constant as a string llvm-svn: 1020 --- include/llvm/Support/StringExtras.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/include/llvm/Support/StringExtras.h b/include/llvm/Support/StringExtras.h index a9e6bb3e837..22d02c3140a 100644 --- a/include/llvm/Support/StringExtras.h +++ b/include/llvm/Support/StringExtras.h @@ -1,7 +1,6 @@ //===-- StringExtras.h - Useful string functions -----------------*- C++ -*--=// // // This file contains some functions that are useful when dealing with strings. -// No library is required when using these functinons. // //===----------------------------------------------------------------------===// @@ -12,6 +11,8 @@ #include #include "llvm/Support/DataTypes.h" +class ConstPoolArray; + static inline string utostr(uint64_t X, bool isNeg = false) { char Buffer[40]; char *BufPtr = Buffer+39; @@ -73,4 +74,15 @@ printIndent(unsigned int indent, ostream& os=cout, const char* const istr=" ") for (unsigned i=0; i < indent; i++) os << istr; } + +// Can we treat the specified array as a string? Only if it is an array of +// ubytes or non-negative sbytes. +// +bool isStringCompatible(ConstPoolArray *CPA); + +// getAsCString - Return the specified array as a C compatible string, only if +// the predicate isStringCompatible is true. +// +string getAsCString(ConstPoolArray *CPA); + #endif