forked from OSchip/llvm-project
Replace assert with static_assert here applicable.
Replaces assert() with static_assert() if the condition is can be evaluated at compile time. llvm-svn: 360753
This commit is contained in:
parent
c18740976e
commit
4c1d6ee83d
|
@ -1023,7 +1023,7 @@ IRExecutionUnit::MemoryManager::getSymbolAddress(const std::string &Name) {
|
|||
|
||||
void *IRExecutionUnit::MemoryManager::getPointerToNamedFunction(
|
||||
const std::string &Name, bool AbortOnFailure) {
|
||||
assert(sizeof(void *) == 8);
|
||||
static_assert(sizeof(void *) == 8, "");
|
||||
|
||||
return (void *)getSymbolAddress(Name);
|
||||
}
|
||||
|
|
|
@ -1103,7 +1103,8 @@ CommandObject::ArgumentTableEntry CommandObject::g_arguments_data[] = {
|
|||
const CommandObject::ArgumentTableEntry *CommandObject::GetArgumentTable() {
|
||||
// If this assertion fires, then the table above is out of date with the
|
||||
// CommandArgumentType enumeration
|
||||
assert((sizeof(CommandObject::g_arguments_data) /
|
||||
sizeof(CommandObject::ArgumentTableEntry)) == eArgTypeLastArg);
|
||||
static_assert((sizeof(CommandObject::g_arguments_data) /
|
||||
sizeof(CommandObject::ArgumentTableEntry)) == eArgTypeLastArg,
|
||||
"");
|
||||
return CommandObject::g_arguments_data;
|
||||
}
|
||||
|
|
|
@ -1972,8 +1972,8 @@ bool RenderScriptRuntime::JITTypePacked(AllocationDetails *alloc,
|
|||
|
||||
// We want 4 elements from packed data
|
||||
const uint32_t num_exprs = 4;
|
||||
assert(num_exprs == (eExprTypeElemPtr - eExprTypeDimX + 1) &&
|
||||
"Invalid number of expressions");
|
||||
static_assert(num_exprs == (eExprTypeElemPtr - eExprTypeDimX + 1),
|
||||
"Invalid number of expressions");
|
||||
|
||||
char expr_bufs[num_exprs][jit_max_expr_size];
|
||||
uint64_t results[num_exprs];
|
||||
|
@ -2031,8 +2031,8 @@ bool RenderScriptRuntime::JITElementPacked(Element &elem,
|
|||
|
||||
// We want 4 elements from packed data
|
||||
const uint32_t num_exprs = 4;
|
||||
assert(num_exprs == (eExprElementFieldCount - eExprElementType + 1) &&
|
||||
"Invalid number of expressions");
|
||||
static_assert(num_exprs == (eExprElementFieldCount - eExprElementType + 1),
|
||||
"Invalid number of expressions");
|
||||
|
||||
char expr_bufs[num_exprs][jit_max_expr_size];
|
||||
uint64_t results[num_exprs];
|
||||
|
@ -2090,8 +2090,8 @@ bool RenderScriptRuntime::JITSubelements(Element &elem,
|
|||
}
|
||||
|
||||
const short num_exprs = 3;
|
||||
assert(num_exprs == (eExprSubelementsArrSize - eExprSubelementsId + 1) &&
|
||||
"Invalid number of expressions");
|
||||
static_assert(num_exprs == (eExprSubelementsArrSize - eExprSubelementsId + 1),
|
||||
"Invalid number of expressions");
|
||||
|
||||
char expr_buffer[jit_max_expr_size];
|
||||
uint64_t results;
|
||||
|
|
|
@ -782,7 +782,7 @@ RegisterContextMinidump_ARM64::RegisterContextMinidump_ARM64(
|
|||
auto regs_data = data.GetData(&offset, sizeof(m_regs.v));
|
||||
if (regs_data)
|
||||
memcpy(m_regs.v, regs_data, sizeof(m_regs.v));
|
||||
assert(k_num_regs == k_num_reg_infos);
|
||||
static_assert(k_num_regs == k_num_reg_infos, "");
|
||||
}
|
||||
size_t RegisterContextMinidump_ARM64::GetRegisterCount() { return k_num_regs; }
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ bool MachVMRegion::GetRegionForAddress(nub_addr_t addr) {
|
|||
m_start = addr;
|
||||
m_depth = 1024;
|
||||
mach_msg_type_number_t info_size = kRegionInfoSize;
|
||||
assert(sizeof(info_size) == 4);
|
||||
static_assert(sizeof(info_size) == 4, "");
|
||||
m_err =
|
||||
::mach_vm_region_recurse(m_task, &m_start, &m_size, &m_depth,
|
||||
(vm_region_recurse_info_t)&m_data, &info_size);
|
||||
|
|
Loading…
Reference in New Issue