From: Owen Anderson Date: Thu, 18 May 2006 05:46:08 +0000 (+0000) Subject: Fix some think-o's in my last commit. Thanks to Chris for pointing them out. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ac4c75ba8253dbd918d0cb5aa8614d8f4f7d7ad7;p=oota-llvm.git Fix some think-o's in my last commit. Thanks to Chris for pointing them out. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28380 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp index 9fdc13ddb69..da7d410423f 100644 --- a/lib/VMCore/Module.cpp +++ b/lib/VMCore/Module.cpp @@ -89,58 +89,60 @@ void Module::dump() const { /// Target endian information... Module::Endianness Module::getEndianness() const { std::string temp = DataLayout; + Module::Endianness ret = AnyEndianness; - while (temp.length() > 0) { + while (!temp.empty()) { std::string token = getToken(temp, "-"); if (token[0] == 'e') { - return LittleEndian; + ret = LittleEndian; } else if (token[0] == 'E') { - return BigEndian; + ret = BigEndian; } } - return AnyEndianness; + return ret; } void Module::setEndianness(Endianness E) { - if (DataLayout.compare("") != 0 && E != AnyEndianness) - DataLayout.insert(0, "-"); + if (!DataLayout.empty() && E != AnyEndianness) + DataLayout += "-"; if (E == LittleEndian) - DataLayout.insert(0, "e"); + DataLayout += "e"; else if (E == BigEndian) - DataLayout.insert(0, "E"); + DataLayout += "E"; } /// Target Pointer Size information... Module::PointerSize Module::getPointerSize() const { std::string temp = DataLayout; + Module::PointerSize ret = AnyPointerSize; - while (temp.length() > 0) { + while (!temp.empty()) { std::string token = getToken(temp, "-"); char signal = getToken(token, ":")[0]; if (signal == 'p') { int size = atoi(getToken(token, ":").c_str()); if (size == 32) - return Pointer32; + ret = Pointer32; else if (size == 64) - return Pointer64; + ret = Pointer64; } } - return AnyPointerSize; + return ret; } void Module::setPointerSize(PointerSize PS) { - if (DataLayout.compare("") != 0 && PS != AnyPointerSize) - DataLayout.insert(0, "-"); + if (!DataLayout.empty() && PS != AnyPointerSize) + DataLayout += "-"; if (PS == Pointer32) - DataLayout.insert(0, "p:32:32"); + DataLayout += "p:32:32"; else if (PS == Pointer64) - DataLayout.insert(0, "p:64:64"); + DataLayout += "p:64:64"; } //===----------------------------------------------------------------------===//