aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Module.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2006-05-18 05:46:08 +0000
committerOwen Anderson <resistor@mac.com>2006-05-18 05:46:08 +0000
commitac4c75ba8253dbd918d0cb5aa8614d8f4f7d7ad7 (patch)
treea9cf657a08737b6306e7a133dae64590386896fd /lib/VMCore/Module.cpp
parent1d8b8535ec6ccbf07b0e83c5be6aec51feed1d45 (diff)
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
Diffstat (limited to 'lib/VMCore/Module.cpp')
-rw-r--r--lib/VMCore/Module.cpp34
1 files changed, 18 insertions, 16 deletions
diff --git a/lib/VMCore/Module.cpp b/lib/VMCore/Module.cpp
index 9fdc13ddb6..da7d410423 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";
}
//===----------------------------------------------------------------------===//