TestClangASTContext: Rewrite an if-else chain into a switch

This avoids the "ambiguous else" warning, which comes from within the
EXPECT_TRUE macro.

llvm-svn: 351331
This commit is contained in:
Pavel Labath 2019-01-16 12:43:01 +00:00
parent dd487d6521
commit 2a32a69c53
1 changed files with 11 additions and 3 deletions

View File

@ -190,12 +190,20 @@ void VerifyEncodingAndBitSize(clang::ASTContext *context,
return;
EXPECT_TRUE(type_ptr->isBuiltinType());
if (encoding == eEncodingSint)
switch (encoding) {
case eEncodingSint:
EXPECT_TRUE(type_ptr->isSignedIntegerType());
else if (encoding == eEncodingUint)
break;
case eEncodingUint:
EXPECT_TRUE(type_ptr->isUnsignedIntegerType());
else if (encoding == eEncodingIEEE754)
break;
case eEncodingIEEE754:
EXPECT_TRUE(type_ptr->isFloatingType());
break;
default:
FAIL() << "Unexpected encoding";
break;
}
}
TEST_F(TestClangASTContext, TestBuiltinTypeForEncodingAndBitSize) {