[llvm] r265548 - [RegisterBankInfo] Inline the destructor to avoid link-time error when GlobalISel is not built.
Quentin Colombet via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 6 08:47:17 PDT 2016
Author: qcolombet
Date: Wed Apr 6 10:47:17 2016
New Revision: 265548
URL: http://llvm.org/viewvc/llvm-project?rev=265548&view=rev
Log:
[RegisterBankInfo] Inline the destructor to avoid link-time error when GlobalISel is not built.
Modified:
llvm/trunk/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
llvm/trunk/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
Modified: llvm/trunk/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h?rev=265548&r1=265547&r2=265548&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/RegisterBankInfo.h Wed Apr 6 10:47:17 2016
@@ -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.
Modified: llvm/trunk/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp?rev=265548&r1=265547&r2=265548&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp Wed Apr 6 10:47:17 2016
@@ -27,8 +27,6 @@ RegisterBankInfo::RegisterBankInfo(unsig
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);
More information about the llvm-commits
mailing list