Index: include/llvm/CodeGen/AccelTable.h =================================================================== --- include/llvm/CodeGen/AccelTable.h +++ include/llvm/CodeGen/AccelTable.h @@ -130,6 +130,9 @@ #endif protected: virtual uint64_t order() const = 0; + +private: + virtual void anchor(); }; /// A base class holding non-template-dependant functionality of the AccelTable @@ -244,6 +247,9 @@ virtual void emit(AsmPrinter *Asm) const = 0; static uint32_t hash(StringRef Buffer) { return djbHash(Buffer); } + +private: + void anchor() override; }; /// The Data class implementation for DWARF v5 accelerator table. Unlike the Index: include/llvm/CodeGen/GCMetadata.h =================================================================== --- include/llvm/CodeGen/GCMetadata.h +++ include/llvm/CodeGen/GCMetadata.h @@ -157,6 +157,8 @@ /// A helper map to speedup lookups into the above list StringMap GCStrategyMap; + virtual void anchor(); + public: /// Lookup the GCStrategy object associated with the given gc name. /// Objects are owned internally; No caller should attempt to delete the Index: include/llvm/CodeGen/GCStrategy.h =================================================================== --- include/llvm/CodeGen/GCStrategy.h +++ include/llvm/CodeGen/GCStrategy.h @@ -83,6 +83,8 @@ std::string Name; + virtual void anchor(); + protected: bool UseStatepoints = false; /// Uses gc.statepoints as opposed to gc.roots, /// if set, none of the other options can be Index: include/llvm/CodeGen/SelectionDAG.h =================================================================== --- include/llvm/CodeGen/SelectionDAG.h +++ include/llvm/CodeGen/SelectionDAG.h @@ -298,6 +298,9 @@ : 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 Index: include/llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h =================================================================== --- include/llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h +++ include/llvm/DebugInfo/CodeView/TypeVisitorCallbacks.h @@ -17,6 +17,8 @@ namespace codeview { class TypeVisitorCallbacks { + virtual void anchor(); + public: virtual ~TypeVisitorCallbacks() = default; Index: include/llvm/DebugInfo/DIContext.h =================================================================== --- include/llvm/DebugInfo/DIContext.h +++ include/llvm/DebugInfo/DIContext.h @@ -206,6 +206,7 @@ private: const DIContextKind Kind; + virtual void anchor(); }; /// An inferface for inquiring the load address of a loaded object file Index: include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h =================================================================== --- include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h +++ include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h @@ -37,6 +37,9 @@ public: /// An abstract class representing a single entry in the accelerator tables. class Entry { + private: + virtual void anchor(); + protected: SmallVector Values; Index: include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h =================================================================== --- include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h +++ include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h @@ -155,6 +155,9 @@ const uint64_t Length; CFIProgram CFIs; + +private: + virtual void anchor(); }; /// DWARF Common Information Entry (CIE) Index: include/llvm/DebugInfo/DWARF/DWARFUnit.h =================================================================== --- include/llvm/DebugInfo/DWARF/DWARFUnit.h +++ include/llvm/DebugInfo/DWARF/DWARFUnit.h @@ -62,6 +62,9 @@ StringRef SS, const DWARFSection &SOS, const DWARFSection *AOS, const DWARFSection &LS, bool isLittleEndian, bool isDWO, bool Lazy) = 0; + +private: + virtual void anchor(); }; const DWARFUnitIndex &getDWARFUnitIndex(DWARFContext &Context, Index: include/llvm/MC/MCCodePadder.h =================================================================== --- include/llvm/MC/MCCodePadder.h +++ include/llvm/MC/MCCodePadder.h @@ -128,6 +128,7 @@ MCCodePaddingPolicy() = delete; MCCodePaddingPolicy(const MCCodePaddingPolicy &) = delete; void operator=(const MCCodePaddingPolicy &) = delete; + virtual void anchor(); protected: /// A mask holding the kind of this policy, i.e. only the i'th bit will be set Index: include/llvm/MC/MCSection.h =================================================================== --- include/llvm/MC/MCSection.h +++ include/llvm/MC/MCSection.h @@ -88,6 +88,8 @@ /// below that number. SmallVector, 1> SubsectionFragmentMap; + virtual void anchor(); + protected: SectionVariant Variant; SectionKind Kind; Index: include/llvm/MC/MCSubtargetInfo.h =================================================================== --- include/llvm/MC/MCSubtargetInfo.h +++ include/llvm/MC/MCSubtargetInfo.h @@ -174,6 +174,8 @@ virtual std::string getSchedInfoStr(MCInst const &MCI) const { return {}; } +private: + virtual void anchor(); }; } // end namespace llvm Index: include/llvm/Object/Error.h =================================================================== --- include/llvm/Object/Error.h +++ include/llvm/Object/Error.h @@ -56,6 +56,9 @@ // Default to parse_failed, can be overridden with setErrorCode. setErrorCode(make_error_code(object_error::parse_failed)); } + +private: + virtual void anchor(); }; /// Generic binary error. Index: include/llvm/Support/BinaryByteStream.h =================================================================== --- include/llvm/Support/BinaryByteStream.h +++ include/llvm/Support/BinaryByteStream.h @@ -67,6 +67,9 @@ protected: llvm::support::endianness Endian; ArrayRef Data; + +private: + virtual void anchor() override; }; /// \brief An implementation of BinaryStream whose data is backed by an llvm @@ -81,6 +84,9 @@ MemBuffer(std::move(Buffer)) {} std::unique_ptr MemBuffer; + +private: + virtual void anchor() override; }; /// \brief An implementation of BinaryStream which holds its entire data set @@ -129,6 +135,7 @@ private: MutableArrayRef Data; BinaryByteStream ImmutableStream; + void anchor() override; }; /// \brief An implementation of WritableBinaryStream which can write at its end @@ -199,12 +206,16 @@ } MutableArrayRef data() { return Data; } + +private: + virtual void anchor() override; }; /// \brief An implementation of WritableBinaryStream backed by an llvm /// FileOutputBuffer. class FileBufferByteStream : public WritableBinaryStream { private: + virtual void anchor() override; class StreamImpl : public MutableBinaryByteStream { public: StreamImpl(std::unique_ptr Buffer, @@ -224,6 +235,7 @@ private: std::unique_ptr FileBuffer; + void anchor() override; }; public: Index: include/llvm/Support/BinaryStream.h =================================================================== --- include/llvm/Support/BinaryStream.h +++ include/llvm/Support/BinaryStream.h @@ -64,6 +64,9 @@ return make_error(stream_error_code::stream_too_short); return Error::success(); } + +private: + virtual void anchor(); }; /// \brief A BinaryStream which can be read from as well as written to. Note @@ -95,6 +98,9 @@ return make_error(stream_error_code::invalid_offset); return Error::success(); } + +private: + virtual void anchor() override; }; } // end namespace llvm Index: include/llvm/Support/BinaryStreamReader.h =================================================================== --- include/llvm/Support/BinaryStreamReader.h +++ include/llvm/Support/BinaryStreamReader.h @@ -264,6 +264,7 @@ private: BinaryStreamRef Stream; uint32_t Offset = 0; + virtual void anchor(); }; } // namespace llvm Index: include/llvm/Support/Error.h =================================================================== --- include/llvm/Support/Error.h +++ include/llvm/Support/Error.h @@ -1045,6 +1045,7 @@ /// std::error_codes. class ECError : public ErrorInfo { friend Error errorCodeToError(std::error_code); + void anchor() override; public: void setErrorCode(std::error_code EC) { this->EC = EC; } Index: include/llvm/Support/FileOutputBuffer.h =================================================================== --- include/llvm/Support/FileOutputBuffer.h +++ include/llvm/Support/FileOutputBuffer.h @@ -68,6 +68,9 @@ FileOutputBuffer(StringRef Path) : FinalPath(Path) {} std::string FinalPath; + +private: + virtual void anchor(); }; } // end namespace llvm Index: include/llvm/Support/FormatVariadicDetails.h =================================================================== --- include/llvm/Support/FormatVariadicDetails.h +++ include/llvm/Support/FormatVariadicDetails.h @@ -20,6 +20,8 @@ namespace detail { class format_adapter { + virtual void anchor(); + protected: virtual ~format_adapter() {} Index: include/llvm/Support/raw_ostream.h =================================================================== --- include/llvm/Support/raw_ostream.h +++ include/llvm/Support/raw_ostream.h @@ -537,6 +537,7 @@ class buffer_ostream : public raw_svector_ostream { raw_ostream &OS; SmallVector Buffer; + void anchor() override; public: buffer_ostream(raw_ostream &OS) : raw_svector_ostream(Buffer), OS(OS) {} Index: include/llvm/TableGen/Record.h =================================================================== --- include/llvm/TableGen/Record.h +++ include/llvm/TableGen/Record.h @@ -1798,6 +1798,7 @@ public: explicit Resolver(Record *CurRec) : CurRec(CurRec) {} virtual ~Resolver() {} + virtual void anchor(); Record *getCurrentRecord() const { return CurRec; } @@ -1858,6 +1859,7 @@ // arguments simultaneously and get rid of this class. class RecordValResolver final : public Resolver { const RecordVal *RV; + void anchor() override; public: explicit RecordValResolver(Record &R, const RecordVal *RV) @@ -1874,6 +1876,7 @@ class ShadowResolver final : public Resolver { Resolver &R; DenseSet Shadowed; + void anchor() override; public: explicit ShadowResolver(Resolver &R) Index: lib/CodeGen/AsmPrinter/AccelTable.cpp =================================================================== --- lib/CodeGen/AsmPrinter/AccelTable.cpp +++ lib/CodeGen/AsmPrinter/AccelTable.cpp @@ -566,6 +566,9 @@ Asm->emitInt32(QualifiedNameHash); } +void AccelTableData::anchor() {} +void AppleAccelTableData::anchor() {} + #ifndef _MSC_VER // The lines below are rejected by older versions (TBD) of MSVC. constexpr AppleAccelTableData::Atom AppleAccelTableTypeData::Atoms[]; Index: lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp =================================================================== --- lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp +++ lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp @@ -269,3 +269,5 @@ // Emit the abbreviations data. Abbrev.Emit(this); } + +void ByteStreamer::anchor() {} Index: lib/CodeGen/AsmPrinter/ByteStreamer.h =================================================================== --- lib/CodeGen/AsmPrinter/ByteStreamer.h +++ lib/CodeGen/AsmPrinter/ByteStreamer.h @@ -33,6 +33,9 @@ virtual void EmitInt8(uint8_t Byte, const Twine &Comment = "") = 0; virtual void EmitSLEB128(uint64_t DWord, const Twine &Comment = "") = 0; virtual void EmitULEB128(uint64_t DWord, const Twine &Comment = "") = 0; + +private: + virtual void anchor(); }; class APByteStreamer final : public ByteStreamer { Index: lib/CodeGen/GCMetadata.cpp =================================================================== --- lib/CodeGen/GCMetadata.cpp +++ lib/CodeGen/GCMetadata.cpp @@ -181,3 +181,5 @@ } else report_fatal_error(std::string("unsupported GC: ") + Name); } + +void GCModuleInfo::anchor() {} Index: lib/CodeGen/GCStrategy.cpp =================================================================== --- lib/CodeGen/GCStrategy.cpp +++ lib/CodeGen/GCStrategy.cpp @@ -19,3 +19,5 @@ LLVM_INSTANTIATE_REGISTRY(GCRegistry) GCStrategy::GCStrategy() = default; + +void GCStrategy::anchor() {} Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp =================================================================== --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -87,6 +87,8 @@ void SelectionDAG::DAGUpdateListener::NodeDeleted(SDNode*, SDNode*) {} void SelectionDAG::DAGUpdateListener::NodeUpdated(SDNode*) {} +void SelectionDAG::DAGNodeDeletedListener::anchor() {} + #define DEBUG_TYPE "selectiondag" static void NewSDValueDbgMsg(SDValue V, StringRef Msg, SelectionDAG *G) { Index: lib/DebugInfo/CodeView/RecordName.cpp =================================================================== --- lib/DebugInfo/CodeView/RecordName.cpp +++ lib/DebugInfo/CodeView/RecordName.cpp @@ -331,3 +331,5 @@ StringRef StringData = toStringRef(Sym.content()).drop_front(Offset); return StringData.split('\0').first; } + +void TypeVisitorCallbacks::anchor() {} Index: lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp +++ lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp @@ -861,3 +861,5 @@ return make_range(ValueIterator(), ValueIterator()); return make_range(ValueIterator(*this, Key), ValueIterator()); } + +void DWARFAcceleratorTable::Entry::anchor() {} Index: lib/DebugInfo/DWARF/DWARFDebugFrame.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFDebugFrame.cpp +++ lib/DebugInfo/DWARF/DWARFDebugFrame.cpp @@ -543,3 +543,5 @@ for (const auto &Entry : Entries) Entry->dump(OS, MRI, IsEH); } + +void FrameEntry::anchor() {} Index: lib/DebugInfo/DWARF/DWARFTypeUnit.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFTypeUnit.cpp +++ lib/DebugInfo/DWARF/DWARFTypeUnit.cpp @@ -59,3 +59,5 @@ else OS << "\n\n"; } + +void DIContext::anchor() {} Index: lib/DebugInfo/DWARF/DWARFUnit.cpp =================================================================== --- lib/DebugInfo/DWARF/DWARFUnit.cpp +++ lib/DebugInfo/DWARF/DWARFUnit.cpp @@ -571,3 +571,5 @@ //StrOffsetsContributionDescriptor(Offset, Size, 4, DWARF32)); return StrOffsetsContributionDescriptor(Offset, Size, 4, DWARF32); } + +void DWARFUnitSectionBase::anchor() {} Index: lib/MC/MCCodePadder.cpp =================================================================== --- lib/MC/MCCodePadder.cpp +++ lib/MC/MCCodePadder.cpp @@ -369,3 +369,5 @@ "More fragments necessarily means bigger weight"); return FullWindowWeight - FullWindowFirstPartWeight; } + +void MCCodePaddingPolicy::anchor() {} Index: lib/MC/MCSection.cpp =================================================================== --- lib/MC/MCSection.cpp +++ lib/MC/MCSection.cpp @@ -99,3 +99,5 @@ OS << "]>"; } #endif + +void MCSection::anchor() {} Index: lib/MC/MCSubtargetInfo.cpp =================================================================== --- lib/MC/MCSubtargetInfo.cpp +++ lib/MC/MCSubtargetInfo.cpp @@ -118,3 +118,5 @@ InstrItins = InstrItineraryData(getSchedModel(), Stages, OperandCycles, ForwardingPaths); } + +void MCSubtargetInfo::anchor() {} Index: lib/Object/Binary.cpp =================================================================== --- lib/Object/Binary.cpp +++ lib/Object/Binary.cpp @@ -101,3 +101,5 @@ return OwningBinary(std::move(Bin), std::move(Buffer)); } + +void BinaryError::anchor() {} Index: lib/Support/BinaryStreamReader.cpp =================================================================== --- lib/Support/BinaryStreamReader.cpp +++ lib/Support/BinaryStreamReader.cpp @@ -146,4 +146,6 @@ BinaryStreamReader W1{First}; BinaryStreamReader W2{Second}; return std::make_pair(W1, W2); -} \ No newline at end of file +} + +void BinaryStreamReader::anchor() {} Index: lib/Support/BinaryStreamRef.cpp =================================================================== --- lib/Support/BinaryStreamRef.cpp +++ lib/Support/BinaryStreamRef.cpp @@ -129,3 +129,12 @@ /// \brief For buffered streams, commits changes to the backing store. Error WritableBinaryStreamRef::commit() { return BorrowedImpl->commit(); } + +void WritableBinaryStream::anchor() {} +void FileBufferByteStream::anchor() {} +void FileBufferByteStream::StreamImpl::anchor() {} +void MutableBinaryByteStream ::anchor() {} +void AppendingBinaryByteStream::anchor() {} +void BinaryByteStream::anchor() {} +void MemoryBufferByteStream::anchor() {} +void BinaryStream::anchor() {} Index: lib/Support/Error.cpp =================================================================== --- lib/Support/Error.cpp +++ lib/Support/Error.cpp @@ -49,6 +49,7 @@ namespace llvm { void ErrorInfoBase::anchor() {} +void ECError::anchor() {} char ErrorInfoBase::ID = 0; char ErrorList::ID = 0; char ECError::ID = 0; Index: lib/Support/FileOutputBuffer.cpp =================================================================== --- lib/Support/FileOutputBuffer.cpp +++ lib/Support/FileOutputBuffer.cpp @@ -168,3 +168,5 @@ return createInMemoryBuffer(Path, Size, Mode); } } + +void FileOutputBuffer::anchor() {} Index: lib/Support/FormatVariadic.cpp =================================================================== --- lib/Support/FormatVariadic.cpp +++ lib/Support/FormatVariadic.cpp @@ -152,3 +152,5 @@ } return Replacements; } + +void detail::format_adapter::anchor() {} Index: lib/Support/raw_ostream.cpp =================================================================== --- lib/Support/raw_ostream.cpp +++ lib/Support/raw_ostream.cpp @@ -475,6 +475,7 @@ } void raw_ostream::anchor() {} +void buffer_ostream::anchor() {} //===----------------------------------------------------------------------===// // Formatted Output Index: lib/TableGen/Record.cpp =================================================================== --- lib/TableGen/Record.cpp +++ lib/TableGen/Record.cpp @@ -2257,3 +2257,7 @@ FoundUnresolved = true; return I; } + +void Resolver::anchor() {} +void ShadowResolver::anchor() {} +void RecordValResolver::anchor() {}