Include functionality to get a string array constant as a string

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1020 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2001-10-29 13:24:31 +00:00
parent ed077c479b
commit 5f62191f02

View File

@ -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 <stdio.h>
#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