Skip to content

Commit 108630d

Browse files
committed
Basic: simplify endianness classification (NFC)
Collapse the cases into a single set rather than adding a case for each entry. This is easier to read/follow. NFC.
1 parent b6db784 commit 108630d

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

lib/Basic/LangOptions.cpp

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ std::pair<bool, bool> LangOptions::setTarget(llvm::Triple triple) {
209209

210210
// Set the "os" platform condition.
211211
switch (Target.getOS()) {
212+
case llvm::Triple::Darwin:
212213
case llvm::Triple::MacOSX:
213214
addPlatformConditionValue(PlatformConditionKind::OS, "OSX");
214215
break;
@@ -285,30 +286,19 @@ std::pair<bool, bool> LangOptions::setTarget(llvm::Triple triple) {
285286

286287
// Set the "_endian" platform condition.
287288
switch (Target.getArch()) {
289+
default: llvm_unreachable("undefined architecture endianness");
288290
case llvm::Triple::ArchType::arm:
289291
case llvm::Triple::ArchType::thumb:
290-
addPlatformConditionValue(PlatformConditionKind::Endianness, "little");
291-
break;
292292
case llvm::Triple::ArchType::aarch64:
293-
addPlatformConditionValue(PlatformConditionKind::Endianness, "little");
294-
break;
295-
case llvm::Triple::ArchType::ppc64:
296-
addPlatformConditionValue(PlatformConditionKind::Endianness, "big");
297-
break;
298293
case llvm::Triple::ArchType::ppc64le:
299-
addPlatformConditionValue(PlatformConditionKind::Endianness, "little");
300-
break;
301294
case llvm::Triple::ArchType::x86:
302-
addPlatformConditionValue(PlatformConditionKind::Endianness, "little");
303-
break;
304295
case llvm::Triple::ArchType::x86_64:
305296
addPlatformConditionValue(PlatformConditionKind::Endianness, "little");
306297
break;
298+
case llvm::Triple::ArchType::ppc64:
307299
case llvm::Triple::ArchType::systemz:
308300
addPlatformConditionValue(PlatformConditionKind::Endianness, "big");
309301
break;
310-
default:
311-
llvm_unreachable("undefined architecture endianness");
312302
}
313303

314304
// Set the "runtime" platform condition.

0 commit comments

Comments
 (0)