diff --git a/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h b/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h index 1982ac68d61ae..cd00e5f3934c6 100644 --- a/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h +++ b/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h @@ -36,7 +36,7 @@ class MachineFunctionAnalysis std::unique_ptr MF; public: - Result(std::unique_ptr MF) : MF(std::move(MF)) {} + Result(std::unique_ptr MF); MachineFunction &getMF() { return *MF; }; LLVM_ABI bool invalidate(Function &, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &); diff --git a/llvm/include/llvm/CodeGen/ResourcePriorityQueue.h b/llvm/include/llvm/CodeGen/ResourcePriorityQueue.h index bd63dd8756210..c15bc677ae53f 100644 --- a/llvm/include/llvm/CodeGen/ResourcePriorityQueue.h +++ b/llvm/include/llvm/CodeGen/ResourcePriorityQueue.h @@ -75,6 +75,7 @@ namespace llvm { public: ResourcePriorityQueue(SelectionDAGISel *IS); + ~ResourcePriorityQueue(); bool isBottomUp() const override { return false; } diff --git a/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h b/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h index 9c04ff63c8059..07d599cf9b5c6 100644 --- a/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h +++ b/llvm/include/llvm/DebugInfo/GSYM/GsymContext.h @@ -30,6 +30,7 @@ class GsymReader; class GsymContext : public DIContext { public: GsymContext(std::unique_ptr Reader); + ~GsymContext(); GsymContext(GsymContext &) = delete; GsymContext &operator=(GsymContext &) = delete; diff --git a/llvm/include/llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h b/llvm/include/llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h index 49ba20af72636..fccea2c65ba14 100644 --- a/llvm/include/llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h +++ b/llvm/include/llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h @@ -10,6 +10,7 @@ #define LLVM_DEBUGINFO_PDB_CONCRETESYMBOLENUMERATOR_H #include "llvm/DebugInfo/PDB/IPDBEnumChildren.h" +#include "llvm/DebugInfo/PDB/PDBSymbol.h" #include "llvm/DebugInfo/PDB/PDBTypes.h" #include "llvm/Support/Casting.h" #include diff --git a/llvm/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h b/llvm/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h index 7e15433b839ed..aec93c928a760 100644 --- a/llvm/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h +++ b/llvm/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h @@ -13,6 +13,7 @@ #include "llvm/ADT/BitmaskEnum.h" #include "llvm/ADT/SmallVector.h" #include "llvm/DebugInfo/CodeView/CodeView.h" +#include "llvm/DebugInfo/PDB/IPDBLineNumber.h" #include "llvm/Support/Compiler.h" #include diff --git a/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h b/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h index 0e7b9663f27d2..71df1d59c2177 100644 --- a/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h +++ b/llvm/include/llvm/DebugInfo/PDB/Native/InputFile.h @@ -55,9 +55,9 @@ class InputFile { getOrCreateTypeCollection(TypeCollectionKind Kind); public: - InputFile(PDBFile *Pdb) { PdbOrObj = Pdb; } - InputFile(object::COFFObjectFile *Obj) { PdbOrObj = Obj; } - InputFile(MemoryBuffer *Buffer) { PdbOrObj = Buffer; } + InputFile(PDBFile *Pdb); + InputFile(object::COFFObjectFile *Obj); + InputFile(MemoryBuffer *Buffer); LLVM_ABI ~InputFile(); InputFile(InputFile &&Other) = default; diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h index d797d00cfa123..a7e8e60af7160 100644 --- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h +++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h @@ -10,6 +10,7 @@ #define LLVM_DEBUGINFO_PDB_PDBSYMBOLFUNC_H #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h" +#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h" #include "llvm/Support/Compiler.h" #include "PDBSymbol.h" @@ -21,7 +22,6 @@ namespace pdb { class PDBSymDumper; class PDBSymbolData; -class PDBSymbolTypeFunctionSig; template class IPDBEnumChildren; class LLVM_ABI PDBSymbolFunc : public PDBSymbol { diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h index a054b0c02db83..b21cd092939e6 100644 --- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h +++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h @@ -20,6 +20,7 @@ namespace pdb { class LLVM_ABI PDBSymbolTypeBuiltin : public PDBSymbol { DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::BuiltinType) public: + ~PDBSymbolTypeBuiltin(); void dump(PDBSymDumper &Dumper) const override; FORWARD_SYMBOL_METHOD(getBuiltinType) diff --git a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h index 431bf0dab90d9..acc58e10e71c7 100644 --- a/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h +++ b/llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h @@ -11,9 +11,11 @@ #include "PDBSymbol.h" #include "PDBTypes.h" +#include "llvm/DebugInfo/PDB/IPDBLineNumber.h" #include "llvm/Support/Compiler.h" #include "llvm/DebugInfo/PDB/IPDBRawSymbol.h" +#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h" namespace llvm { diff --git a/llvm/include/llvm/MC/MCGOFFStreamer.h b/llvm/include/llvm/MC/MCGOFFStreamer.h index 6d029f6bd4a29..8888d9e7bdbb3 100644 --- a/llvm/include/llvm/MC/MCGOFFStreamer.h +++ b/llvm/include/llvm/MC/MCGOFFStreamer.h @@ -20,9 +20,7 @@ class MCGOFFStreamer : public MCObjectStreamer { public: MCGOFFStreamer(MCContext &Context, std::unique_ptr MAB, std::unique_ptr OW, - std::unique_ptr Emitter) - : MCObjectStreamer(Context, std::move(MAB), std::move(OW), - std::move(Emitter)) {} + std::unique_ptr Emitter); ~MCGOFFStreamer() override; diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp b/llvm/lib/CodeGen/LiveDebugVariables.cpp index f12f437c493e1..9d98e6c085fe3 100644 --- a/llvm/lib/CodeGen/LiveDebugVariables.cpp +++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp @@ -536,12 +536,6 @@ class UserLabel { namespace llvm { -/// Implementation of the LiveDebugVariables pass. - -LiveDebugVariables::LiveDebugVariables() = default; -LiveDebugVariables::~LiveDebugVariables() = default; -LiveDebugVariables::LiveDebugVariables(LiveDebugVariables &&) = default; - class LiveDebugVariables::LDVImpl { LocMap::Allocator allocator; MachineFunction *MF = nullptr; @@ -683,6 +677,12 @@ class LiveDebugVariables::LDVImpl { void print(raw_ostream&); }; +/// Implementation of the LiveDebugVariables pass. + +LiveDebugVariables::LiveDebugVariables() = default; +LiveDebugVariables::~LiveDebugVariables() = default; +LiveDebugVariables::LiveDebugVariables(LiveDebugVariables &&) = default; + } // namespace llvm static void printDebugLoc(const DebugLoc &DL, raw_ostream &CommentOS, diff --git a/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp b/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp index 116a919585d70..17a7f48e3f2e4 100644 --- a/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp +++ b/llvm/lib/CodeGen/MachineFunctionAnalysis.cpp @@ -21,6 +21,10 @@ using namespace llvm; AnalysisKey MachineFunctionAnalysis::Key; +llvm::MachineFunctionAnalysis::Result::Result( + std::unique_ptr MF) + : MF(std::move(MF)) {} + bool MachineFunctionAnalysis::Result::invalidate( Function &, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &) { diff --git a/llvm/lib/CodeGen/SelectionDAG/ResourcePriorityQueue.cpp b/llvm/lib/CodeGen/SelectionDAG/ResourcePriorityQueue.cpp index 0a449fd011e69..72ea0898f9754 100644 --- a/llvm/lib/CodeGen/SelectionDAG/ResourcePriorityQueue.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/ResourcePriorityQueue.cpp @@ -63,6 +63,8 @@ ResourcePriorityQueue::ResourcePriorityQueue(SelectionDAGISel *IS) HorizontalVerticalBalance = 0; } +ResourcePriorityQueue::~ResourcePriorityQueue() = default; + unsigned ResourcePriorityQueue::numberRCValPredInSU(SUnit *SU, unsigned RCId) { unsigned NumberDeps = 0; diff --git a/llvm/lib/DebugInfo/GSYM/GsymContext.cpp b/llvm/lib/DebugInfo/GSYM/GsymContext.cpp index 18be6d0985462..62b4caa327d87 100644 --- a/llvm/lib/DebugInfo/GSYM/GsymContext.cpp +++ b/llvm/lib/DebugInfo/GSYM/GsymContext.cpp @@ -14,6 +14,7 @@ using namespace llvm; using namespace llvm::gsym; +GsymContext::~GsymContext() = default; GsymContext::GsymContext(std::unique_ptr Reader) : DIContext(CK_GSYM), Reader(std::move(Reader)) {} diff --git a/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp b/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp index 328d0f5ab060f..49be0edc33a10 100644 --- a/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp +++ b/llvm/lib/DebugInfo/PDB/Native/InputFile.cpp @@ -586,3 +586,8 @@ bool llvm::pdb::shouldDumpSymbolGroup(uint32_t Idx, const SymbolGroup &Group, // Otherwise, only dump if this is the same module specified. return (Filters.DumpModi == Idx); } +llvm::pdb::InputFile::InputFile(PDBFile *Pdb) { PdbOrObj = Pdb; } + +llvm::pdb::InputFile::InputFile(object::COFFObjectFile *Obj) { PdbOrObj = Obj; } + +llvm::pdb::InputFile::InputFile(MemoryBuffer *Buffer) { PdbOrObj = Buffer; } diff --git a/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp b/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp index eca2a09c1f77b..7c8ef18f126dd 100644 --- a/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp +++ b/llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp @@ -10,6 +10,12 @@ #include "llvm/DebugInfo/PDB/PDBSymDumper.h" +namespace llvm { +namespace pdb { +PDBSymbolTypeBuiltin::~PDBSymbolTypeBuiltin() = default; +} // namespace pdb +} // namespace llvm + using namespace llvm; using namespace llvm::pdb; diff --git a/llvm/lib/MC/MCGOFFStreamer.cpp b/llvm/lib/MC/MCGOFFStreamer.cpp index 1718e2a4eb2d7..8b228db0e8b30 100644 --- a/llvm/lib/MC/MCGOFFStreamer.cpp +++ b/llvm/lib/MC/MCGOFFStreamer.cpp @@ -45,3 +45,9 @@ MCStreamer *llvm::createGOFFStreamer(MCContext &Context, new MCGOFFStreamer(Context, std::move(MAB), std::move(OW), std::move(CE)); return S; } +llvm::MCGOFFStreamer::MCGOFFStreamer(MCContext &Context, + std::unique_ptr MAB, + std::unique_ptr OW, + std::unique_ptr Emitter) + : MCObjectStreamer(Context, std::move(MAB), std::move(OW), + std::move(Emitter)) {} diff --git a/llvm/lib/ObjCopy/ELF/ELFObject.cpp b/llvm/lib/ObjCopy/ELF/ELFObject.cpp index e5de17e093dfd..78b674c5fa348 100644 --- a/llvm/lib/ObjCopy/ELF/ELFObject.cpp +++ b/llvm/lib/ObjCopy/ELF/ELFObject.cpp @@ -1307,6 +1307,9 @@ Error BasicELFBuilder::initSections() { return Error::success(); } +BasicELFBuilder::BasicELFBuilder() : Obj(std::make_unique()) {} +BasicELFBuilder::~BasicELFBuilder() = default; + void BinaryELFBuilder::addData(SymbolTableSection *SymTab) { auto Data = ArrayRef( reinterpret_cast(MemBuf->getBufferStart()), diff --git a/llvm/lib/ObjCopy/ELF/ELFObject.h b/llvm/lib/ObjCopy/ELF/ELFObject.h index d8f79a4b1a3cc..7ec0e9be3ddaf 100644 --- a/llvm/lib/ObjCopy/ELF/ELFObject.h +++ b/llvm/lib/ObjCopy/ELF/ELFObject.h @@ -1059,7 +1059,8 @@ class BasicELFBuilder { Error initSections(); public: - BasicELFBuilder() : Obj(std::make_unique()) {} + BasicELFBuilder(); + ~BasicELFBuilder(); }; class BinaryELFBuilder : public BasicELFBuilder { diff --git a/llvm/lib/Remarks/BitstreamRemarkParser.cpp b/llvm/lib/Remarks/BitstreamRemarkParser.cpp index 312886013598d..20a8ebbadc681 100644 --- a/llvm/lib/Remarks/BitstreamRemarkParser.cpp +++ b/llvm/lib/Remarks/BitstreamRemarkParser.cpp @@ -600,3 +600,5 @@ BitstreamRemarkParser::processRemark(BitstreamRemarkParserHelper &Helper) { return std::move(Result); } +llvm::remarks::BitstreamRemarkParser::BitstreamRemarkParser(StringRef Buf) + : RemarkParser(Format::Bitstream), ParserHelper(Buf) {} diff --git a/llvm/lib/Remarks/BitstreamRemarkParser.h b/llvm/lib/Remarks/BitstreamRemarkParser.h index f6f79ef199f7e..061206471fee4 100644 --- a/llvm/lib/Remarks/BitstreamRemarkParser.h +++ b/llvm/lib/Remarks/BitstreamRemarkParser.h @@ -45,8 +45,7 @@ struct BitstreamRemarkParser : public RemarkParser { /// Create a parser that expects to find a string table embedded in the /// stream. - explicit BitstreamRemarkParser(StringRef Buf) - : RemarkParser(Format::Bitstream), ParserHelper(Buf) {} + explicit BitstreamRemarkParser(StringRef Buf); Expected> next() override; diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp index 0c6add59cb282..f928ded16186f 100644 --- a/llvm/lib/TableGen/TGParser.cpp +++ b/llvm/lib/TableGen/TGParser.cpp @@ -33,6 +33,14 @@ using namespace llvm; namespace llvm { +RecordsEntry::RecordsEntry(std::unique_ptr Rec) : Rec(std::move(Rec)) {} +RecordsEntry::RecordsEntry(std::unique_ptr Loop) + : Loop(std::move(Loop)) {} +RecordsEntry::RecordsEntry(std::unique_ptr Assertion) + : Assertion(std::move(Assertion)) {} +RecordsEntry::RecordsEntry(std::unique_ptr Dump) + : Dump(std::move(Dump)) {} + struct SubClassReference { SMRange RefRange; const Record *Rec = nullptr; diff --git a/llvm/lib/TableGen/TGParser.h b/llvm/lib/TableGen/TGParser.h index 7edb6c7a9aac6..09b7d5380695d 100644 --- a/llvm/lib/TableGen/TGParser.h +++ b/llvm/lib/TableGen/TGParser.h @@ -46,12 +46,10 @@ struct RecordsEntry { void dump() const; RecordsEntry() = default; - RecordsEntry(std::unique_ptr Rec) : Rec(std::move(Rec)) {} - RecordsEntry(std::unique_ptr Loop) : Loop(std::move(Loop)) {} - RecordsEntry(std::unique_ptr Assertion) - : Assertion(std::move(Assertion)) {} - RecordsEntry(std::unique_ptr Dump) - : Dump(std::move(Dump)) {} + RecordsEntry(std::unique_ptr Rec); + RecordsEntry(std::unique_ptr Loop); + RecordsEntry(std::unique_ptr Assertion); + RecordsEntry(std::unique_ptr Dump); }; /// ForeachLoop - Record the iteration state associated with a for loop. diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp index 543c4c5ddfc9d..37fe32531800c 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp @@ -36,6 +36,12 @@ RISCVTargetELFStreamer::RISCVTargetELFStreamer(MCStreamer &S, setFlagsFromFeatures(STI); } +RISCVELFStreamer::RISCVELFStreamer(MCContext &C, + std::unique_ptr MAB, + std::unique_ptr MOW, + std::unique_ptr MCE) + : MCELFStreamer(C, std::move(MAB), std::move(MOW), std::move(MCE)) {} + RISCVELFStreamer &RISCVTargetELFStreamer::getStreamer() { return static_cast(Streamer); } diff --git a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h index 98948cd3e9493..26da2441d4ae1 100644 --- a/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h +++ b/llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.h @@ -28,8 +28,7 @@ class RISCVELFStreamer : public MCELFStreamer { public: RISCVELFStreamer(MCContext &C, std::unique_ptr MAB, std::unique_ptr MOW, - std::unique_ptr MCE) - : MCELFStreamer(C, std::move(MAB), std::move(MOW), std::move(MCE)) {} + std::unique_ptr MCE); void changeSection(MCSection *Section, uint32_t Subsection) override; void emitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI) override; diff --git a/llvm/tools/dsymutil/DebugMap.cpp b/llvm/tools/dsymutil/DebugMap.cpp index f1cd7e402f28d..8798601754ff4 100644 --- a/llvm/tools/dsymutil/DebugMap.cpp +++ b/llvm/tools/dsymutil/DebugMap.cpp @@ -135,6 +135,11 @@ struct YAMLContext { } // end anonymous namespace +DebugMap::DebugMap(const Triple &BinaryTriple, StringRef BinaryPath, + ArrayRef BinaryUUID) + : BinaryTriple(BinaryTriple), BinaryPath(std::string(BinaryPath)), + BinaryUUID(BinaryUUID.begin(), BinaryUUID.end()) {} + ErrorOr>> DebugMap::parseYAMLDebugMap(BinaryHolder &BinHolder, StringRef InputFile, StringRef PrependPath, bool Verbose) { diff --git a/llvm/tools/dsymutil/DebugMap.h b/llvm/tools/dsymutil/DebugMap.h index 8e2a4de94c89e..9a518222a56da 100644 --- a/llvm/tools/dsymutil/DebugMap.h +++ b/llvm/tools/dsymutil/DebugMap.h @@ -91,9 +91,7 @@ class DebugMap { public: DebugMap(const Triple &BinaryTriple, StringRef BinaryPath, - ArrayRef BinaryUUID = ArrayRef()) - : BinaryTriple(BinaryTriple), BinaryPath(std::string(BinaryPath)), - BinaryUUID(BinaryUUID.begin(), BinaryUUID.end()) {} + ArrayRef BinaryUUID = ArrayRef()); using const_iterator = ObjectContainer::const_iterator; diff --git a/llvm/tools/llvm-cov/SourceCoverageView.cpp b/llvm/tools/llvm-cov/SourceCoverageView.cpp index dfecddfaf4143..336ed47992da3 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageView.cpp @@ -21,6 +21,23 @@ using namespace llvm; +ExpansionView::ExpansionView(const CounterMappingRegion &Region, + std::unique_ptr View) + : Region(Region), View(std::move(View)) {} + +ExpansionView::ExpansionView(ExpansionView &&RHS) + : Region(std::move(RHS.Region)), View(std::move(RHS.View)) {} + +ExpansionView &ExpansionView::operator=(ExpansionView &&RHS) { + Region = std::move(RHS.Region); + View = std::move(RHS.View); + return *this; +} + +InstantiationView::InstantiationView(StringRef FunctionName, unsigned Line, + std::unique_ptr View) + : FunctionName(FunctionName), Line(Line), View(std::move(View)) {} + void CoveragePrinter::StreamDestructor::operator()(raw_ostream *OS) const { if (OS == &outs()) return; diff --git a/llvm/tools/llvm-cov/SourceCoverageView.h b/llvm/tools/llvm-cov/SourceCoverageView.h index cff32b756ee32..43fb890ad7687 100644 --- a/llvm/tools/llvm-cov/SourceCoverageView.h +++ b/llvm/tools/llvm-cov/SourceCoverageView.h @@ -32,15 +32,9 @@ struct ExpansionView { std::unique_ptr View; ExpansionView(const CounterMappingRegion &Region, - std::unique_ptr View) - : Region(Region), View(std::move(View)) {} - ExpansionView(ExpansionView &&RHS) - : Region(std::move(RHS.Region)), View(std::move(RHS.View)) {} - ExpansionView &operator=(ExpansionView &&RHS) { - Region = std::move(RHS.Region); - View = std::move(RHS.View); - return *this; - } + std::unique_ptr View); + ExpansionView(ExpansionView &&RHS); + ExpansionView &operator=(ExpansionView &&RHS); unsigned getLine() const { return Region.LineStart; } unsigned getStartCol() const { return Region.ColumnStart; } @@ -58,8 +52,7 @@ struct InstantiationView { std::unique_ptr View; InstantiationView(StringRef FunctionName, unsigned Line, - std::unique_ptr View) - : FunctionName(FunctionName), Line(Line), View(std::move(View)) {} + std::unique_ptr View); friend bool operator<(const InstantiationView &LHS, const InstantiationView &RHS) { diff --git a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp index efaf05adc8f06..42c1cc91a3c1e 100644 --- a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp +++ b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp @@ -479,6 +479,14 @@ bool GroupMatcher::candidateConditionMatches( return Predicate.isIdentical(RepresentativeCondition); } +std::unique_ptr GroupMatcher::popFirstCondition() { + assert(!Conditions.empty() && + "Trying to pop a condition from a condition-less group"); + std::unique_ptr P = std::move(Conditions.front()); + Conditions.erase(Conditions.begin()); + return P; +} + bool GroupMatcher::addMatcher(Matcher &Candidate) { if (!Candidate.hasFirstCondition()) return false; @@ -693,6 +701,9 @@ void SwitchMatcher::emit(MatchTable &Table) { //===- RuleMatcher --------------------------------------------------------===// +RuleMatcher::RuleMatcher(ArrayRef SrcLoc) + : SrcLoc(SrcLoc), RuleID(NextRuleID++) {} + uint64_t RuleMatcher::NextRuleID = 0; StringRef RuleMatcher::getOpcode() const { @@ -1099,6 +1110,8 @@ unsigned RuleMatcher::countRendererFns() const { }); } +void RuleMatcher::insnmatchers_pop_front() { Matchers.erase(Matchers.begin()); } + //===- PredicateMatcher ---------------------------------------------------===// PredicateMatcher::~PredicateMatcher() {} diff --git a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.h b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.h index 620f88db66109..13f29e10beba2 100644 --- a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.h +++ b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.h @@ -366,13 +366,7 @@ class GroupMatcher final : public Matcher { size_t size() const { return Matchers.size(); } bool empty() const { return Matchers.empty(); } - std::unique_ptr popFirstCondition() override { - assert(!Conditions.empty() && - "Trying to pop a condition from a condition-less group"); - std::unique_ptr P = std::move(Conditions.front()); - Conditions.erase(Conditions.begin()); - return P; - } + std::unique_ptr popFirstCondition() override; const PredicateMatcher &getFirstCondition() const override { assert(!Conditions.empty() && "Trying to get a condition from a condition-less group"); @@ -410,7 +404,7 @@ class SwitchMatcher : public Matcher { /// The representative condition, with a type and a path (InsnVarID and OpIdx /// in most cases) shared by all the matchers contained. - std::unique_ptr Condition = nullptr; + std::unique_ptr Condition; /// Temporary set used to check that the case values don't repeat within the /// same switch. @@ -545,7 +539,7 @@ class RuleMatcher : public Matcher { StringRef FlagName, GISelFlags FlagBit); public: - RuleMatcher(ArrayRef SrcLoc) : SrcLoc(SrcLoc), RuleID(NextRuleID++) {} + RuleMatcher(ArrayRef SrcLoc); RuleMatcher(RuleMatcher &&Other) = default; RuleMatcher &operator=(RuleMatcher &&Other) = default; @@ -704,7 +698,7 @@ class RuleMatcher : public Matcher { return make_range(Matchers.begin(), Matchers.end()); } bool insnmatchers_empty() const { return Matchers.empty(); } - void insnmatchers_pop_front() { Matchers.erase(Matchers.begin()); } + void insnmatchers_pop_front(); }; template class PredicateListMatcher {