From 671f3a73df4b52324b9e284b56b0d3fb34169443 Mon Sep 17 00:00:00 2001 From: Richard Trieu Date: Sat, 29 Dec 2018 02:02:13 +0000 Subject: [PATCH] Add vtable anchor to classes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@350142 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/GlobalISel/CallLowering.h | 4 ++++ include/llvm/CodeGen/SelectionDAG.h | 3 +++ include/llvm/IR/DiagnosticInfo.h | 6 ++++++ include/llvm/Object/Error.h | 1 + include/llvm/Support/Error.h | 2 ++ include/llvm/Support/FormatVariadicDetails.h | 2 ++ include/llvm/Support/VirtualFileSystem.h | 2 ++ include/llvm/Support/raw_ostream.h | 2 ++ lib/CodeGen/GlobalISel/CallLowering.cpp | 4 ++++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 2 ++ lib/IR/DiagnosticInfo.cpp | 8 ++++++++ lib/Object/Error.cpp | 1 + lib/Support/Error.cpp | 1 + lib/Support/FormatVariadic.cpp | 2 ++ lib/Support/VirtualFileSystem.cpp | 2 ++ lib/Support/raw_ostream.cpp | 2 ++ 16 files changed, 44 insertions(+) diff --git a/include/llvm/CodeGen/GlobalISel/CallLowering.h b/include/llvm/CodeGen/GlobalISel/CallLowering.h index 32980ce149c..ab498e8f070 100644 --- a/include/llvm/CodeGen/GlobalISel/CallLowering.h +++ b/include/llvm/CodeGen/GlobalISel/CallLowering.h @@ -40,6 +40,7 @@ class Value; class CallLowering { const TargetLowering *TLI; + virtual void anchor(); public: struct ArgInfo { unsigned Reg; @@ -108,6 +109,9 @@ public: MachineIRBuilder &MIRBuilder; MachineRegisterInfo &MRI; CCAssignFn *AssignFn; + + private: + virtual void anchor(); }; protected: diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index 04c13dded3a..67fe87fc96a 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -308,6 +308,9 @@ public: : DAGUpdateListener(DAG), Callback(std::move(Callback)) {} void NodeDeleted(SDNode *N, SDNode *E) override { Callback(N, E); } + + private: + virtual void anchor(); }; /// When true, additional steps are taken to diff --git a/include/llvm/IR/DiagnosticInfo.h b/include/llvm/IR/DiagnosticInfo.h index b5ed2c7d509..3a55a7dca7f 100644 --- a/include/llvm/IR/DiagnosticInfo.h +++ b/include/llvm/IR/DiagnosticInfo.h @@ -101,6 +101,7 @@ private: /// Severity gives the severity of the diagnostic. const DiagnosticSeverity Severity; + virtual void anchor(); public: DiagnosticInfo(/* DiagnosticKind */ int Kind, DiagnosticSeverity Severity) : Kind(Kind), Severity(Severity) {} @@ -210,6 +211,7 @@ public: }; class DiagnosticInfoStackSize : public DiagnosticInfoResourceLimit { + virtual void anchor() override; public: DiagnosticInfoStackSize(const Function &Fn, uint64_t StackSize, DiagnosticSeverity Severity = DS_Warning, @@ -360,6 +362,7 @@ public: /// Common features for diagnostics with an associated location. class DiagnosticInfoWithLocationBase : public DiagnosticInfo { + virtual void anchor() override; public: /// \p Fn is the function where the diagnostic is being emitted. \p Loc is /// the location information to use in the diagnostic. @@ -598,6 +601,7 @@ operator<<(RemarkT &R, /// Common features for diagnostics dealing with optimization remarks /// that are used by IR passes. class DiagnosticInfoIROptimization : public DiagnosticInfoOptimizationBase { + virtual void anchor() override; public: /// \p PassName is the name of the pass emitting this diagnostic. \p /// RemarkName is a textual identifier for the remark (single-word, @@ -818,6 +822,7 @@ private: /// Diagnostic information for optimization analysis remarks related to /// floating-point non-commutativity. class OptimizationRemarkAnalysisFPCommute : public OptimizationRemarkAnalysis { + virtual void anchor(); public: /// \p PassName is the name of the pass emitting this diagnostic. If this name /// matches the regular expression given in -Rpass-analysis=, then the @@ -859,6 +864,7 @@ private: /// Diagnostic information for optimization analysis remarks related to /// pointer aliasing. class OptimizationRemarkAnalysisAliasing : public OptimizationRemarkAnalysis { + virtual void anchor(); public: /// \p PassName is the name of the pass emitting this diagnostic. If this name /// matches the regular expression given in -Rpass-analysis=, then the diff --git a/include/llvm/Object/Error.h b/include/llvm/Object/Error.h index eb938338715..a15f8b9236e 100644 --- a/include/llvm/Object/Error.h +++ b/include/llvm/Object/Error.h @@ -50,6 +50,7 @@ inline std::error_code make_error_code(object_error e) { /// Currently inherits from ECError for easy interoperability with /// std::error_code, but this will be removed in the future. class BinaryError : public ErrorInfo { + virtual void anchor(); public: static char ID; BinaryError() { diff --git a/include/llvm/Support/Error.h b/include/llvm/Support/Error.h index 4962812e750..ee2cbeec97a 100644 --- a/include/llvm/Support/Error.h +++ b/include/llvm/Support/Error.h @@ -1066,6 +1066,8 @@ private: class ECError : public ErrorInfo { friend Error errorCodeToError(std::error_code); + virtual void anchor() override; + public: void setErrorCode(std::error_code EC) { this->EC = EC; } std::error_code convertToErrorCode() const override { return EC; } diff --git a/include/llvm/Support/FormatVariadicDetails.h b/include/llvm/Support/FormatVariadicDetails.h index 56dda430efd..e8bd90f5094 100644 --- a/include/llvm/Support/FormatVariadicDetails.h +++ b/include/llvm/Support/FormatVariadicDetails.h @@ -21,6 +21,8 @@ class Error; namespace detail { class format_adapter { + virtual void anchor(); + protected: virtual ~format_adapter() {} diff --git a/include/llvm/Support/VirtualFileSystem.h b/include/llvm/Support/VirtualFileSystem.h index 3d4094eeb11..606a81e494e 100644 --- a/include/llvm/Support/VirtualFileSystem.h +++ b/include/llvm/Support/VirtualFileSystem.h @@ -383,6 +383,8 @@ protected: private: IntrusiveRefCntPtr FS; + + virtual void anchor(); }; namespace detail { diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h index 9a86f3a371e..d062e716209 100644 --- a/include/llvm/Support/raw_ostream.h +++ b/include/llvm/Support/raw_ostream.h @@ -554,6 +554,8 @@ class buffer_ostream : public raw_svector_ostream { raw_ostream &OS; SmallVector Buffer; + virtual void anchor() override; + public: buffer_ostream(raw_ostream &OS) : raw_svector_ostream(Buffer), OS(OS) {} ~buffer_ostream() override { OS << str(); } diff --git a/lib/CodeGen/GlobalISel/CallLowering.cpp b/lib/CodeGen/GlobalISel/CallLowering.cpp index da972eae756..724ecedf3b3 100644 --- a/lib/CodeGen/GlobalISel/CallLowering.cpp +++ b/lib/CodeGen/GlobalISel/CallLowering.cpp @@ -23,6 +23,8 @@ using namespace llvm; +void CallLowering::anchor() {} + bool CallLowering::lowerCall( MachineIRBuilder &MIRBuilder, ImmutableCallSite CS, unsigned ResReg, ArrayRef ArgRegs, std::function GetCalleeReg) const { @@ -180,3 +182,5 @@ unsigned CallLowering::ValueHandler::extendRegister(unsigned ValReg, } llvm_unreachable("unable to extend register"); } + +void CallLowering::ValueHandler::anchor() {} diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3ae7bd90554..2f26a150b50 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -87,6 +87,8 @@ static SDVTList makeVTList(const EVT *VTs, unsigned NumVTs) { void SelectionDAG::DAGUpdateListener::NodeDeleted(SDNode*, SDNode*) {} void SelectionDAG::DAGUpdateListener::NodeUpdated(SDNode*) {} +void SelectionDAG::DAGNodeDeletedListener::anchor() {} + #define DEBUG_TYPE "selectiondag" static cl::opt EnableMemCpyDAGOpt("enable-memcpy-dag-opt", diff --git a/lib/IR/DiagnosticInfo.cpp b/lib/IR/DiagnosticInfo.cpp index 3c6665bbcb7..dc957ab7dad 100644 --- a/lib/IR/DiagnosticInfo.cpp +++ b/lib/IR/DiagnosticInfo.cpp @@ -104,6 +104,11 @@ void DiagnosticInfoPGOProfile::print(DiagnosticPrinter &DP) const { DP << getMsg(); } +void DiagnosticInfo::anchor() {} +void DiagnosticInfoStackSize::anchor() {} +void DiagnosticInfoWithLocationBase::anchor() {} +void DiagnosticInfoIROptimization::anchor() {} + DiagnosticLocation::DiagnosticLocation(const DebugLoc &DL) { if (!DL) return; @@ -366,6 +371,9 @@ std::string DiagnosticInfoOptimizationBase::getMsg() const { return OS.str(); } +void OptimizationRemarkAnalysisFPCommute::anchor() {} +void OptimizationRemarkAnalysisAliasing::anchor() {} + namespace llvm { namespace yaml { diff --git a/lib/Object/Error.cpp b/lib/Object/Error.cpp index 7d43a84f3e0..6fa23e06c40 100644 --- a/lib/Object/Error.cpp +++ b/lib/Object/Error.cpp @@ -57,6 +57,7 @@ std::string _object_error_category::message(int EV) const { "defined."); } +void BinaryError::anchor() {} char BinaryError::ID = 0; char GenericBinaryError::ID = 0; diff --git a/lib/Support/Error.cpp b/lib/Support/Error.cpp index 0b0be8d48fa..bb5c31a2a35 100644 --- a/lib/Support/Error.cpp +++ b/lib/Support/Error.cpp @@ -54,6 +54,7 @@ namespace llvm { void ErrorInfoBase::anchor() {} char ErrorInfoBase::ID = 0; char ErrorList::ID = 0; +void ECError::anchor() {}; char ECError::ID = 0; char StringError::ID = 0; char FileError::ID = 0; diff --git a/lib/Support/FormatVariadic.cpp b/lib/Support/FormatVariadic.cpp index 6dd133e6c50..1f3505d5f74 100644 --- a/lib/Support/FormatVariadic.cpp +++ b/lib/Support/FormatVariadic.cpp @@ -152,3 +152,5 @@ formatv_object_base::parseFormatString(StringRef Fmt) { } return Replacements; } + +void detail::format_adapter::anchor() { } diff --git a/lib/Support/VirtualFileSystem.cpp b/lib/Support/VirtualFileSystem.cpp index 24581944fa8..360f8d0061f 100644 --- a/lib/Support/VirtualFileSystem.cpp +++ b/lib/Support/VirtualFileSystem.cpp @@ -472,6 +472,8 @@ directory_iterator OverlayFileSystem::dir_begin(const Twine &Dir, std::make_shared(Dir, *this, EC)); } +void ProxyFileSystem::anchor() {} + namespace llvm { namespace vfs { diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 81df38f341c..21dde7ff914 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -914,3 +914,5 @@ void raw_null_ostream::pwrite_impl(const char *Ptr, size_t Size, uint64_t Offset) {} void raw_pwrite_stream::anchor() {} + +void buffer_ostream::anchor() {} -- 2.50.1