mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
[MIPS] Add static_assert that all Fixups are handled in getFixupKind
Summary: I recently added a new Fixup kind to our fork of LLVM but forgot to add it to the table in MipsAsmBackend.cpp. With this static_assert the error would have been caught instead of zero-initializing the array entries for the new fixups. Reviewers: sdardis, atanasyan Reviewed By: atanasyan Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D44895 llvm-svn: 328616
This commit is contained in:
parent
73bfd6d30a
commit
178aaac5c1
@ -16,6 +16,7 @@
|
||||
#include "MCTargetDesc/MipsFixupKinds.h"
|
||||
#include "MCTargetDesc/MipsMCExpr.h"
|
||||
#include "MCTargetDesc/MipsMCTargetDesc.h"
|
||||
#include "llvm/ADT/STLExtras.h"
|
||||
#include "llvm/MC/MCAsmBackend.h"
|
||||
#include "llvm/MC/MCAssembler.h"
|
||||
#include "llvm/MC/MCContext.h"
|
||||
@ -303,7 +304,7 @@ Optional<MCFixupKind> MipsAsmBackend::getFixupKind(StringRef Name) const {
|
||||
|
||||
const MCFixupKindInfo &MipsAsmBackend::
|
||||
getFixupKindInfo(MCFixupKind Kind) const {
|
||||
const static MCFixupKindInfo LittleEndianInfos[Mips::NumTargetFixupKinds] = {
|
||||
const static MCFixupKindInfo LittleEndianInfos[] = {
|
||||
// This table *must* be in same the order of fixup_* kinds in
|
||||
// MipsFixupKinds.h.
|
||||
//
|
||||
@ -374,8 +375,10 @@ getFixupKindInfo(MCFixupKind Kind) const {
|
||||
{ "fixup_Mips_SUB", 0, 64, 0 },
|
||||
{ "fixup_MICROMIPS_SUB", 0, 64, 0 }
|
||||
};
|
||||
static_assert(array_lengthof(LittleEndianInfos) == Mips::NumTargetFixupKinds,
|
||||
"Not all MIPS little endian fixup kinds added!");
|
||||
|
||||
const static MCFixupKindInfo BigEndianInfos[Mips::NumTargetFixupKinds] = {
|
||||
const static MCFixupKindInfo BigEndianInfos[] = {
|
||||
// This table *must* be in same the order of fixup_* kinds in
|
||||
// MipsFixupKinds.h.
|
||||
//
|
||||
@ -446,6 +449,8 @@ getFixupKindInfo(MCFixupKind Kind) const {
|
||||
{ "fixup_Mips_SUB", 0, 64, 0 },
|
||||
{ "fixup_MICROMIPS_SUB", 0, 64, 0 }
|
||||
};
|
||||
static_assert(array_lengthof(BigEndianInfos) == Mips::NumTargetFixupKinds,
|
||||
"Not all MIPS big endian fixup kinds added!");
|
||||
|
||||
if (Kind < FirstTargetFixupKind)
|
||||
return MCAsmBackend::getFixupKindInfo(Kind);
|
||||
|
Loading…
Reference in New Issue
Block a user