BranchWatchTableModel: Assume Unreachable Code Truly Is
This commit is contained in:
parent
7dc0bdd5df
commit
8050760fe9
|
@ -143,6 +143,7 @@ add_library(common
|
|||
TraversalClient.h
|
||||
TraversalProto.h
|
||||
TypeUtils.h
|
||||
Unreachable.h
|
||||
UPnP.cpp
|
||||
UPnP.h
|
||||
VariantUtil.h
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright 2024 Dolphin Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Common/CommonFuncs.h"
|
||||
|
||||
namespace Common
|
||||
{
|
||||
// TODO C++23: Replace with std::unreachable.
|
||||
[[noreturn]] inline void Unreachable()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
Crash();
|
||||
#elif defined(_MSC_VER) && !defined(__clang__)
|
||||
__assume(false);
|
||||
#else
|
||||
__builtin_unreachable();
|
||||
#endif
|
||||
}
|
||||
} // namespace Common
|
|
@ -165,6 +165,7 @@
|
|||
<ClInclude Include="Common\TraversalClient.h" />
|
||||
<ClInclude Include="Common\TraversalProto.h" />
|
||||
<ClInclude Include="Common\TypeUtils.h" />
|
||||
<ClInclude Include="Common\Unreachable.h" />
|
||||
<ClInclude Include="Common\UPnP.h" />
|
||||
<ClInclude Include="Common\VariantUtil.h" />
|
||||
<ClInclude Include="Common\Version.h" />
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "Common/Assert.h"
|
||||
#include "Common/GekkoDisassembler.h"
|
||||
#include "Common/Unreachable.h"
|
||||
#include "Core/Debugger/BranchWatch.h"
|
||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||
|
||||
|
@ -355,7 +356,8 @@ QVariant BranchWatchTableModel::DisplayRoleData(const QModelIndex& index) const
|
|||
case Column::TotalHits:
|
||||
return QString::number(kv->second.total_hits);
|
||||
}
|
||||
return QVariant();
|
||||
static_assert(Column::NumberOfColumns == 8);
|
||||
Common::Unreachable();
|
||||
}
|
||||
|
||||
QVariant BranchWatchTableModel::FontRoleData(const QModelIndex& index) const
|
||||
|
@ -400,7 +402,8 @@ QVariant BranchWatchTableModel::TextAlignmentRoleData(const QModelIndex& index)
|
|||
case Column::DestinSymbol:
|
||||
return QVariant::fromValue(Qt::AlignLeft | Qt::AlignVCenter);
|
||||
}
|
||||
return QVariant();
|
||||
static_assert(Column::NumberOfColumns == 8);
|
||||
Common::Unreachable();
|
||||
}
|
||||
|
||||
QVariant BranchWatchTableModel::ForegroundRoleData(const QModelIndex& index) const
|
||||
|
@ -498,5 +501,6 @@ QVariant BranchWatchTableModel::SortRoleData(const QModelIndex& index) const
|
|||
case Column::TotalHits:
|
||||
return qulonglong{kv->second.total_hits};
|
||||
}
|
||||
return QVariant();
|
||||
static_assert(Column::NumberOfColumns == 8);
|
||||
Common::Unreachable();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue