summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Labath <pavel@labath.sk>2019-01-16 12:43:01 +0000
committerPavel Labath <pavel@labath.sk>2019-01-16 12:43:01 +0000
commit6dfbb7db39f245c578430c2669ae8bc01f2656d1 (patch)
tree2903c4ee7e00ff90a98c9d8f1c83053e5019d0c8
parent7877a6507bcb09b7ccb4905b5dba591a553889d0 (diff)
TestClangASTContext: Rewrite an if-else chain into a switch
This avoids the "ambiguous else" warning, which comes from within the EXPECT_TRUE macro.
-rw-r--r--lldb/unittests/Symbol/TestClangASTContext.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/lldb/unittests/Symbol/TestClangASTContext.cpp b/lldb/unittests/Symbol/TestClangASTContext.cpp
index ad2cb2c9e54..28df732fc79 100644
--- a/lldb/unittests/Symbol/TestClangASTContext.cpp
+++ b/lldb/unittests/Symbol/TestClangASTContext.cpp
@@ -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) {