@@ -164,27 +164,33 @@ std::shared_ptr<ArrayValueView> KTestObjectParser::multiArrayView(const std::vec
164164
165165 for (size_t curPos = offsetInBits; curPos < offsetInBits + arraySizeInBits; curPos += elementLenInBits) {
166166 switch (typesHandler.getTypeKind (baseType)) {
167- case TypeKind::STRUCT_LIKE:
168- views.push_back (structView (byteArray, lazyPointersArray, typesHandler.getStructInfo (baseType), curPos, usage));
169- break ;
170- case TypeKind::ENUM:
171- views.push_back (enumView (byteArray, typesHandler.getEnumInfo (type), curPos, elementLenInBits));
172- break ;
173- case TypeKind::PRIMITIVE:
174- views.push_back (primitiveView (byteArray, baseType, curPos, elementLenInBits));
175- break ;
176- case TypeKind::OBJECT_POINTER:
177- case TypeKind::ARRAY:
178- LOG_S (ERROR) << " Invariant ERROR: base type is pointer/array: " << type.typeName ();
179- // No break here
180- case TypeKind::UNKNOWN:
181- throw UnImplementedException (
182- std::string (" Arrays don't support element type: " + type.typeName ())
183- );
184- default :
185- std::string message = " Missing case for this TypeKind in switch" ;
186- LOG_S (ERROR) << message;
187- throw NoSuchTypeException (message);
167+ case TypeKind::STRUCT_LIKE: {
168+ views.push_back (
169+ structView (byteArray, lazyPointersArray, typesHandler.getStructInfo (baseType), curPos, usage));
170+ break ;
171+ }
172+ case TypeKind::ENUM: {
173+ views.push_back (enumView (byteArray, typesHandler.getEnumInfo (type), curPos, elementLenInBits));
174+ break ;
175+ }
176+ case TypeKind::PRIMITIVE: {
177+ views.push_back (primitiveView (byteArray, baseType, curPos, elementLenInBits));
178+ break ;
179+ }
180+ case TypeKind::OBJECT_POINTER:
181+ case TypeKind::ARRAY:
182+ LOG_S (ERROR) << " Invariant ERROR: base type is pointer/array: " << type.typeName ();
183+ // No break here
184+ case TypeKind::UNKNOWN: {
185+ std::string message = " Arrays don't support element type: " + type.typeName ();
186+ LOG_S (ERROR) << message;
187+ throw UnImplementedException (message);
188+ }
189+ default : {
190+ std::string message = " Missing case for this TypeKind in switch" ;
191+ LOG_S (ERROR) << message;
192+ throw NoSuchTypeException (message);
193+ }
188194 }
189195 }
190196
@@ -240,14 +246,16 @@ std::shared_ptr<ArrayValueView> KTestObjectParser::arrayView(const std::vector<c
240246 break ;
241247 case TypeKind::OBJECT_POINTER:
242248 case TypeKind::ARRAY:
243- case TypeKind::UNKNOWN:
244- throw UnImplementedException (
245- std::string (" Arrays don't support element type: " + type.typeName ())
246- );
247- default :
249+ case TypeKind::UNKNOWN: {
250+ std::string message = " Arrays don't support element type: " + type.typeName ();
251+ LOG_S (ERROR) << message;
252+ throw UnImplementedException (message);
253+ }
254+ default : {
248255 std::string message = " Missing case for this TypeKind in switch" ;
249256 LOG_S (ERROR) << message;
250257 throw NoSuchTypeException (message);
258+ }
251259 }
252260 }
253261 return std::make_shared<ArrayValueView>(subViews);
@@ -384,16 +392,17 @@ std::shared_ptr<StructValueView> KTestObjectParser::structView(const std::vector
384392 case TypeKind::FUNCTION_POINTER:
385393 subViews.push_back (functionPointerView (curStruct.name , field.name ));
386394 break ;
387- case TypeKind::UNKNOWN:
395+ case TypeKind::UNKNOWN: {
388396 // TODO: pointers
389- throw UnImplementedException (
390- std::string ( " Structs don't support fields of type: " + field. type . typeName ())
391- );
392-
393- default :
397+ std::string message = " Structs don't support fields of type: " + field. type . typeName ();
398+ LOG_S (ERROR) << message;
399+ throw UnImplementedException (message );
400+ }
401+ default : {
394402 std::string message = " Missing case for this TypeKind in switch" ;
395403 LOG_S (ERROR) << message;
396404 throw NoSuchTypeException (message);
405+ }
397406 }
398407
399408 if (!dirtyInitializedField && sizeOfFieldToInitUnion < fieldLen &&
@@ -646,7 +655,9 @@ void KTestObjectParser::assignTypeUnnamedVar(
646655
647656 if (testCase.objects [curType.jsonInd ].is_lazy ) {
648657 if (types::TypesHandler::baseTypeIsVoid (paramType)) {
649- throw UnImplementedException (" Lazy variable has baseType=void" );
658+ std::string message = " Lazy variable has baseType=void" ;
659+ LOG_S (ERROR) << message;
660+ throw UnImplementedException (message);
650661 }
651662
652663 usages[curType.jsonInd ] = types::PointerUsage::LAZY;
@@ -1220,8 +1231,11 @@ std::shared_ptr<AbstractValueView> KTestObjectParser::testParameterView(
12201231 return arrayView (rawData, kleeParam.pointers , paramType.baseTypeObj (),
12211232 SizeUtils::bytesToBits (rawData.size ()), 0 , usage);
12221233 }
1223- case TypeKind::UNKNOWN:
1224- throw UnImplementedException (" No such type" );
1234+ case TypeKind::UNKNOWN: {
1235+ std::string message = " No such type" ;
1236+ LOG_S (ERROR) << message;
1237+ throw UnImplementedException (message);
1238+ }
12251239 default : {
12261240 std::string message = " Missing case for this TypeKind in switch" ;
12271241 LOG_S (ERROR) << message;
0 commit comments