From eba9167e7b0e8dff6a772ffd7706731d1d73b7eb Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Mon, 4 Aug 2014 16:40:55 +0000 Subject: [PATCH] Add a dummy subtarget to the CPP backend target machine. This will allow us to forward all of the standard TargetMachine calls to the subtarget and still return null as we were before. llvm-svn: 214727 --- llvm/lib/Target/CppBackend/CPPTargetMachine.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/CppBackend/CPPTargetMachine.h b/llvm/lib/Target/CppBackend/CPPTargetMachine.h index 673ade7..2d58e52 100644 --- a/llvm/lib/Target/CppBackend/CPPTargetMachine.h +++ b/llvm/lib/Target/CppBackend/CPPTargetMachine.h @@ -16,24 +16,30 @@ #include "llvm/IR/DataLayout.h" #include "llvm/Target/TargetMachine.h" +#include "llvm/Target/TargetSubtargetInfo.h" namespace llvm { class formatted_raw_ostream; +class CPPSubtarget : public TargetSubtargetInfo { +}; + struct CPPTargetMachine : public TargetMachine { CPPTargetMachine(const Target &T, StringRef TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL) - : TargetMachine(T, TT, CPU, FS, Options) {} + : TargetMachine(T, TT, CPU, FS, Options), Subtarget() {} +private: + CPPSubtarget Subtarget; +public: + const CPPSubtarget *getSubtargetImpl() const override { return &Subtarget; } bool addPassesToEmitFile(PassManagerBase &PM, formatted_raw_ostream &Out, CodeGenFileType FileType, bool DisableVerify, AnalysisID StartAfter, AnalysisID StopAfter) override; - - const DataLayout *getDataLayout() const override { return nullptr; } }; extern Target TheCppBackendTarget; -- 2.7.4