un-indent a huge amount of code out of an anonymous namespace.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106500 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2010-06-21 23:12:56 +00:00
parent c27d1e4d17
commit 7e6d7451ae

View File

@@ -153,9 +153,11 @@ namespace {
void printModuleBody(); void printModuleBody();
}; };
} // end anonymous namespace.
// FIXME: Shouldn't be using globals for this.
static unsigned indent_level = 0; static unsigned indent_level = 0;
inline formatted_raw_ostream& nl(formatted_raw_ostream& Out, int delta = 0) { static formatted_raw_ostream& nl(formatted_raw_ostream &Out, int delta = 0) {
Out << "\n"; Out << "\n";
if (delta >= 0 || indent_level >= unsigned(-delta)) if (delta >= 0 || indent_level >= unsigned(-delta))
indent_level += delta; indent_level += delta;
@@ -164,23 +166,20 @@ namespace {
return Out; return Out;
} }
inline void in() { indent_level++; } static inline void in() { indent_level++; }
inline void out() { if (indent_level >0) indent_level--; } static inline void out() { if (indent_level >0) indent_level--; }
inline void static inline void sanitize(std::string &str) {
sanitize(std::string& str) {
for (size_t i = 0; i < str.length(); ++i) for (size_t i = 0; i < str.length(); ++i)
if (!isalnum(str[i]) && str[i] != '_') if (!isalnum(str[i]) && str[i] != '_')
str[i] = '_'; str[i] = '_';
} }
inline std::string static std::string getTypePrefix(const Type *Ty) {
getTypePrefix(const Type* Ty ) {
switch (Ty->getTypeID()) { switch (Ty->getTypeID()) {
case Type::VoidTyID: return "void_"; case Type::VoidTyID: return "void_";
case Type::IntegerTyID: case Type::IntegerTyID:
return std::string("int") + utostr(cast<IntegerType>(Ty)->getBitWidth()) + return "int" + utostr(cast<IntegerType>(Ty)->getBitWidth()) + "_";
"_";
case Type::FloatTyID: return "float_"; case Type::FloatTyID: return "float_";
case Type::DoubleTyID: return "double_"; case Type::DoubleTyID: return "double_";
case Type::LabelTyID: return "label_"; case Type::LabelTyID: return "label_";
@@ -199,7 +198,7 @@ namespace {
// a null pointer if it wasn't found. Note that this isn't the same as the // a null pointer if it wasn't found. Note that this isn't the same as the
// Mode::getTypeName function which will return an empty string, not a null // Mode::getTypeName function which will return an empty string, not a null
// pointer if the name is not found. // pointer if the name is not found.
inline const std::string* static const std::string *
findTypeName(const TypeSymbolTable& ST, const Type* Ty) { findTypeName(const TypeSymbolTable& ST, const Type* Ty) {
TypeSymbolTable::const_iterator TI = ST.begin(); TypeSymbolTable::const_iterator TI = ST.begin();
TypeSymbolTable::const_iterator TE = ST.end(); TypeSymbolTable::const_iterator TE = ST.end();
@@ -2006,7 +2005,6 @@ namespace {
return false; return false;
} }
}
char CppWriter::ID = 0; char CppWriter::ID = 0;