Author: labath
Date: Wed Jan 16 04:43:01 2019
New Revision: 351331

URL: http://llvm.org/viewvc/llvm-project?rev=351331&view=rev
Log:
TestClangASTContext: Rewrite an if-else chain into a switch

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

Modified:
    lldb/trunk/unittests/Symbol/TestClangASTContext.cpp

Modified: lldb/trunk/unittests/Symbol/TestClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Symbol/TestClangASTContext.cpp?rev=351331&r1=351330&r2=351331&view=diff
==============================================================================
--- lldb/trunk/unittests/Symbol/TestClangASTContext.cpp (original)
+++ lldb/trunk/unittests/Symbol/TestClangASTContext.cpp Wed Jan 16 04:43:01 2019
@@ -190,12 +190,20 @@ void VerifyEncodingAndBitSize(clang::AST
     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) {


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to