[RegisterBankInfo] Inline the destructor to avoid link-time error when GlobalISel is not built.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265548 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Quentin Colombet 2016-04-06 15:47:17 +00:00
parent 1145b58255
commit bc6e9634c0
2 changed files with 12 additions and 3 deletions

View File

@ -16,6 +16,7 @@
#define LLVM_CODEGEN_GLOBALISEL_REGBANKINFO_H
#include "llvm/CodeGen/GlobalISel/RegisterBank.h"
#include "llvm/Support/ErrorHandling.h"
#include <cassert>
#include <memory> // For unique_ptr.
@ -39,7 +40,17 @@ protected:
/// addRegBankCoverage RegisterBank.
RegisterBankInfo(unsigned NumRegBanks);
virtual ~RegisterBankInfo();
/// This constructor is meaningless.
/// It just provides a default constructor that can be used at link time
/// when GlobalISel is not built.
/// That way, targets can still inherit from this class without doing
/// crazy gymnastic to avoid link time failures.
/// \note That works because the constructor is inlined.
RegisterBankInfo() {
llvm_unreachable("This constructor should not be executed");
}
virtual ~RegisterBankInfo() {}
/// Create a new register bank with the given parameter and add it
/// to RegBanks.

View File

@ -27,8 +27,6 @@ RegisterBankInfo::RegisterBankInfo(unsigned NumRegBanks)
RegBanks.reset(new RegisterBank[NumRegBanks]);
}
RegisterBankInfo::~RegisterBankInfo() {}
void RegisterBankInfo::verify(const TargetRegisterInfo &TRI) const {
for (unsigned Idx = 0, End = getNumRegBanks(); Idx != End; ++Idx) {
const RegisterBank &RegBank = getRegBank(Idx);