aboutsummaryrefslogtreecommitdiffstats
path: root/support/lib/Support
diff options
context:
space:
mode:
Diffstat (limited to 'support/lib/Support')
-rw-r--r--support/lib/Support/CommandLine.cpp4
-rw-r--r--support/lib/Support/StringExtras.cpp66
2 files changed, 2 insertions, 68 deletions
diff --git a/support/lib/Support/CommandLine.cpp b/support/lib/Support/CommandLine.cpp
index bc337ee8b5..f6938169da 100644
--- a/support/lib/Support/CommandLine.cpp
+++ b/support/lib/Support/CommandLine.cpp
@@ -9,8 +9,8 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Support/CommandLine.h"
-#include "llvm/Support/STLExtras.h"
+#include "Support/CommandLine.h"
+#include "Support/STLExtras.h"
#include <vector>
#include <algorithm>
#include <map>
diff --git a/support/lib/Support/StringExtras.cpp b/support/lib/Support/StringExtras.cpp
deleted file mode 100644
index 2229df049a..0000000000
--- a/support/lib/Support/StringExtras.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-#include "llvm/Support/StringExtras.h"
-#include "llvm/ConstPoolVals.h"
-#include "llvm/DerivedTypes.h"
-
-// 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) {
- const Type *ETy = cast<ArrayType>(CPA->getType())->getElementType();
- if (ETy == Type::UByteTy) return true;
- if (ETy != Type::SByteTy) return false;
-
- for (unsigned i = 0; i < CPA->getNumOperands(); ++i)
- if (cast<ConstPoolSInt>(CPA->getOperand(i))->getValue() < 0)
- return false;
-
- return true;
-}
-
-// toOctal - Convert the low order bits of X into an octal letter
-static inline char toOctal(int X) {
- return (X&7)+'0';
-}
-
-// getAsCString - Return the specified array as a C compatible string, only if
-// the predicate isStringCompatible is true.
-//
-string getAsCString(ConstPoolArray *CPA) {
- if (isStringCompatible(CPA)) {
- string Result;
- const Type *ETy = cast<ArrayType>(CPA->getType())->getElementType();
- Result = "\"";
- for (unsigned i = 0; i < CPA->getNumOperands(); ++i) {
- unsigned char C = (ETy == Type::SByteTy) ?
- (unsigned char)cast<ConstPoolSInt>(CPA->getOperand(i))->getValue() :
- (unsigned char)cast<ConstPoolUInt>(CPA->getOperand(i))->getValue();
-
- if (isprint(C)) {
- Result += C;
- } else {
- switch(C) {
- case '\a': Result += "\\a"; break;
- case '\b': Result += "\\b"; break;
- case '\f': Result += "\\f"; break;
- case '\n': Result += "\\n"; break;
- case '\r': Result += "\\r"; break;
- case '\t': Result += "\\t"; break;
- case '\v': Result += "\\v"; break;
- default:
- Result += '\\';
- Result += toOctal(C >> 6);
- Result += toOctal(C >> 3);
- Result += toOctal(C >> 0);
- break;
- }
- }
- }
- Result += "\"";
-
- return Result;
- } else {
- return CPA->getStrValue();
- }
-}