Skip to content

Commit eec7f8f

Browse files
smanna12tlively
authored andcommitted
[WebAssembly] Add missing default cases in switch statements
unsigned variable 'IntNo' has been declared but not been defined inside function EmitWebAssemblyBuiltinExpr(). static code analysis tool complains about uninitialized variable "IntNo" since this enters to default branch without setting any intrinsics and calls Function *Callee = CGM.getIntrinsic(IntNo). This patch fixes the problem by adding default cases in switch statements.
1 parent b63919e commit eec7f8f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17365,6 +17365,8 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID,
1736517365
case WebAssembly::BI__builtin_wasm_widen_high_u_i32x4_i64x2:
1736617366
IntNo = Intrinsic::wasm_widen_high_unsigned;
1736717367
break;
17368+
default:
17369+
llvm_unreachable("unexpected builtin ID");
1736817370
}
1736917371
Function *Callee = CGM.getIntrinsic(IntNo);
1737017372
return Builder.CreateCall(Callee, Vec);
@@ -17383,6 +17385,8 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID,
1738317385
case WebAssembly::BI__builtin_wasm_widen_u_i8x16_i32x4:
1738417386
IntNo = Intrinsic::wasm_widen_unsigned;
1738517387
break;
17388+
default:
17389+
llvm_unreachable("unexpected builtin ID");
1738617390
}
1738717391
Function *Callee = CGM.getIntrinsic(IntNo);
1738817392
return Builder.CreateCall(Callee, {Vec, SubVec});
@@ -17398,6 +17402,8 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID,
1739817402
case WebAssembly::BI__builtin_wasm_convert_low_u_i32x4_f64x2:
1739917403
IntNo = Intrinsic::wasm_convert_low_unsigned;
1740017404
break;
17405+
default:
17406+
llvm_unreachable("unexpected builtin ID");
1740117407
}
1740217408
Function *Callee = CGM.getIntrinsic(IntNo);
1740317409
return Builder.CreateCall(Callee, Vec);
@@ -17413,6 +17419,8 @@ Value *CodeGenFunction::EmitWebAssemblyBuiltinExpr(unsigned BuiltinID,
1741317419
case WebAssembly::BI__builtin_wasm_trunc_saturate_zero_u_f64x2_i32x4:
1741417420
IntNo = Intrinsic::wasm_trunc_saturate_zero_unsigned;
1741517421
break;
17422+
default:
17423+
llvm_unreachable("unexpected builtin ID");
1741617424
}
1741717425
Function *Callee = CGM.getIntrinsic(IntNo);
1741817426
return Builder.CreateCall(Callee, Vec);

0 commit comments

Comments
 (0)