Switch the llvm::Triple class to immediately parse the triple string on

construction. Simplify its interface, implementation, and users
accordingly as there is no longer an 'uninitialized' state to check for.
Also, fixes a bug lurking in the interface as there was one method that
didn't correctly check for initialization.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151024 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chandler Carruth
2012-02-21 03:39:36 +00:00
parent 4b04578d65
commit 124e51c0d2
5 changed files with 30 additions and 58 deletions

View File

@@ -154,7 +154,7 @@ TEST(TripleTest, Normalization) {
// Check that normalizing a permutated set of valid components returns a
// triple with the unpermuted components.
StringRef C[4];
for (int Arch = 1+Triple::UnknownArch; Arch < Triple::InvalidArch; ++Arch) {
for (int Arch = 1+Triple::UnknownArch; Arch <= Triple::amdil; ++Arch) {
C[0] = Triple::getArchTypeName(Triple::ArchType(Arch));
for (int Vendor = 1+Triple::UnknownVendor; Vendor <= Triple::PC;
++Vendor) {
@@ -273,11 +273,6 @@ TEST(TripleTest, BitWidthPredicates) {
EXPECT_FALSE(T.isArch32Bit());
EXPECT_FALSE(T.isArch64Bit());
T.setArch(Triple::InvalidArch);
EXPECT_FALSE(T.isArch16Bit());
EXPECT_FALSE(T.isArch32Bit());
EXPECT_FALSE(T.isArch64Bit());
T.setArch(Triple::arm);
EXPECT_FALSE(T.isArch16Bit());
EXPECT_TRUE(T.isArch32Bit());