[llvm-branch-commits] [llvm] release/21.x: [llvm] Support building with c++23 (#154372) (PR #162510)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Oct 8 09:31:10 PDT 2025
https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/162510
Backport 5d0294fcb61560a228e230e8a477fc44746ec62b
Requested by: @frederick-vs-ja
>From e1315b14a444097c6c3aff6d62d4b1974c4c54ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kyle=20Kr=C3=BCger?=
<7158199+kykrueger at users.noreply.github.com>
Date: Fri, 29 Aug 2025 14:52:07 +0200
Subject: [PATCH] [llvm] Support building with c++23 (#154372)
closes #154331
This PR addresses all minimum changes needed to compile LLVM and MLIR
with the c++23 standard.
It is a work in progress and to be reviewed for better methods of
handling the parts of the build broken by c++23.
(cherry picked from commit 5d0294fcb61560a228e230e8a477fc44746ec62b)
---
.../llvm/CodeGen/MachineFunctionAnalysis.h | 2 +-
.../llvm/CodeGen/ResourcePriorityQueue.h | 1 +
llvm/include/llvm/DebugInfo/GSYM/GsymContext.h | 1 +
.../DebugInfo/PDB/ConcreteSymbolEnumerator.h | 1 +
llvm/include/llvm/DebugInfo/PDB/IPDBRawSymbol.h | 1 +
.../llvm/DebugInfo/PDB/Native/InputFile.h | 6 +++---
llvm/include/llvm/DebugInfo/PDB/PDBSymbolFunc.h | 2 +-
.../llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h | 1 +
.../llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h | 2 ++
llvm/include/llvm/MC/MCGOFFStreamer.h | 4 +---
llvm/lib/CodeGen/LiveDebugVariables.cpp | 12 ++++++------
llvm/lib/CodeGen/MachineFunctionAnalysis.cpp | 4 ++++
.../SelectionDAG/ResourcePriorityQueue.cpp | 2 ++
llvm/lib/DebugInfo/GSYM/GsymContext.cpp | 1 +
llvm/lib/DebugInfo/PDB/Native/InputFile.cpp | 5 +++++
llvm/lib/DebugInfo/PDB/PDBSymbolTypeBuiltin.cpp | 6 ++++++
llvm/lib/MC/MCGOFFStreamer.cpp | 6 ++++++
llvm/lib/ObjCopy/ELF/ELFObject.cpp | 3 +++
llvm/lib/ObjCopy/ELF/ELFObject.h | 3 ++-
llvm/lib/Remarks/BitstreamRemarkParser.cpp | 2 ++
llvm/lib/Remarks/BitstreamRemarkParser.h | 3 +--
llvm/lib/TableGen/TGParser.cpp | 8 ++++++++
llvm/lib/TableGen/TGParser.h | 10 ++++------
.../RISCV/MCTargetDesc/RISCVELFStreamer.cpp | 6 ++++++
.../RISCV/MCTargetDesc/RISCVELFStreamer.h | 3 +--
llvm/tools/dsymutil/DebugMap.cpp | 5 +++++
llvm/tools/dsymutil/DebugMap.h | 4 +---
llvm/tools/llvm-cov/SourceCoverageView.cpp | 17 +++++++++++++++++
llvm/tools/llvm-cov/SourceCoverageView.h | 15 ++++-----------
.../Common/GlobalISel/GlobalISelMatchTable.cpp | 13 +++++++++++++
.../Common/GlobalISel/GlobalISelMatchTable.h | 14 ++++----------
31 files changed, 114 insertions(+), 49 deletions(-)
diff --git a/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h b/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
index 98a60c987bbe3..f67d2032ff5cf 100644
--- a/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
+++ b/llvm/include/llvm/CodeGen/MachineFunctionAnalysis.h
@@ -36,7 +36,7 @@ class MachineFunctionAnalysis
std::unique_ptr<MachineFunction> MF;
public:
- Result(std::unique_ptr<MachineFunction> MF) : MF(std::move(MF)) {}
+ Result(std::unique_ptr<MachineFunction> 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<GsymReader> 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 <algorithm>
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 <memory>
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 <typename ChildType> 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<MCAsmBackend> MAB,
std::unique_ptr<MCObjectWriter> OW,
- std::unique_ptr<MCCodeEmitter> Emitter)
- : MCObjectStreamer(Context, std::move(MAB), std::move(OW),
- std::move(Emitter)) {}
+ std::unique_ptr<MCCodeEmitter> 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 e7a4d6d61e211..5575038206bdc 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<MachineFunction> 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<GsymReader> 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 b7021915e7b70..280f5b386a4f6 100644
--- a/llvm/lib/MC/MCGOFFStreamer.cpp
+++ b/llvm/lib/MC/MCGOFFStreamer.cpp
@@ -49,3 +49,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<MCAsmBackend> MAB,
+ std::unique_ptr<MCObjectWriter> OW,
+ std::unique_ptr<MCCodeEmitter> 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<Object>()) {}
+BasicELFBuilder::~BasicELFBuilder() = default;
+
void BinaryELFBuilder::addData(SymbolTableSection *SymTab) {
auto Data = ArrayRef<uint8_t>(
reinterpret_cast<const uint8_t *>(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<Object>()) {}
+ 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<std::unique_ptr<Remark>> next() override;
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index 62c5355654149..883418a583395 100644
--- a/llvm/lib/TableGen/TGParser.cpp
+++ b/llvm/lib/TableGen/TGParser.cpp
@@ -32,6 +32,14 @@ using namespace llvm;
namespace llvm {
+RecordsEntry::RecordsEntry(std::unique_ptr<Record> Rec) : Rec(std::move(Rec)) {}
+RecordsEntry::RecordsEntry(std::unique_ptr<ForeachLoop> Loop)
+ : Loop(std::move(Loop)) {}
+RecordsEntry::RecordsEntry(std::unique_ptr<Record::AssertionInfo> Assertion)
+ : Assertion(std::move(Assertion)) {}
+RecordsEntry::RecordsEntry(std::unique_ptr<Record::DumpInfo> 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 2a5a1925343cf..14de6b469c9a1 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<Record> Rec) : Rec(std::move(Rec)) {}
- RecordsEntry(std::unique_ptr<ForeachLoop> Loop) : Loop(std::move(Loop)) {}
- RecordsEntry(std::unique_ptr<Record::AssertionInfo> Assertion)
- : Assertion(std::move(Assertion)) {}
- RecordsEntry(std::unique_ptr<Record::DumpInfo> Dump)
- : Dump(std::move(Dump)) {}
+ RecordsEntry(std::unique_ptr<Record> Rec);
+ RecordsEntry(std::unique_ptr<ForeachLoop> Loop);
+ RecordsEntry(std::unique_ptr<Record::AssertionInfo> Assertion);
+ RecordsEntry(std::unique_ptr<Record::DumpInfo> 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 c654fd2b5cbe0..986e2d86675e9 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<MCAsmBackend> MAB,
+ std::unique_ptr<MCObjectWriter> MOW,
+ std::unique_ptr<MCCodeEmitter> MCE)
+ : MCELFStreamer(C, std::move(MAB), std::move(MOW), std::move(MCE)) {}
+
RISCVELFStreamer &RISCVTargetELFStreamer::getStreamer() {
return static_cast<RISCVELFStreamer &>(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<MCAsmBackend> MAB,
std::unique_ptr<MCObjectWriter> MOW,
- std::unique_ptr<MCCodeEmitter> MCE)
- : MCELFStreamer(C, std::move(MAB), std::move(MOW), std::move(MCE)) {}
+ std::unique_ptr<MCCodeEmitter> 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<uint8_t> BinaryUUID)
+ : BinaryTriple(BinaryTriple), BinaryPath(std::string(BinaryPath)),
+ BinaryUUID(BinaryUUID.begin(), BinaryUUID.end()) {}
+
ErrorOr<std::vector<std::unique_ptr<DebugMap>>>
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<uint8_t> BinaryUUID = ArrayRef<uint8_t>())
- : BinaryTriple(BinaryTriple), BinaryPath(std::string(BinaryPath)),
- BinaryUUID(BinaryUUID.begin(), BinaryUUID.end()) {}
+ ArrayRef<uint8_t> BinaryUUID = ArrayRef<uint8_t>());
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<SourceCoverageView> 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<SourceCoverageView> 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<SourceCoverageView> View;
ExpansionView(const CounterMappingRegion &Region,
- std::unique_ptr<SourceCoverageView> 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<SourceCoverageView> 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<SourceCoverageView> View;
InstantiationView(StringRef FunctionName, unsigned Line,
- std::unique_ptr<SourceCoverageView> View)
- : FunctionName(FunctionName), Line(Line), View(std::move(View)) {}
+ std::unique_ptr<SourceCoverageView> 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 70141ba738bdb..4afdb68c347b4 100644
--- a/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp
+++ b/llvm/utils/TableGen/Common/GlobalISel/GlobalISelMatchTable.cpp
@@ -476,6 +476,14 @@ bool GroupMatcher::candidateConditionMatches(
return Predicate.isIdentical(RepresentativeCondition);
}
+std::unique_ptr<PredicateMatcher> GroupMatcher::popFirstCondition() {
+ assert(!Conditions.empty() &&
+ "Trying to pop a condition from a condition-less group");
+ std::unique_ptr<PredicateMatcher> P = std::move(Conditions.front());
+ Conditions.erase(Conditions.begin());
+ return P;
+}
+
bool GroupMatcher::addMatcher(Matcher &Candidate) {
if (!Candidate.hasFirstCondition())
return false;
@@ -690,6 +698,9 @@ void SwitchMatcher::emit(MatchTable &Table) {
//===- RuleMatcher --------------------------------------------------------===//
+RuleMatcher::RuleMatcher(ArrayRef<SMLoc> SrcLoc)
+ : SrcLoc(SrcLoc), RuleID(NextRuleID++) {}
+
uint64_t RuleMatcher::NextRuleID = 0;
StringRef RuleMatcher::getOpcode() const {
@@ -1096,6 +1107,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<PredicateMatcher> popFirstCondition() override {
- assert(!Conditions.empty() &&
- "Trying to pop a condition from a condition-less group");
- std::unique_ptr<PredicateMatcher> P = std::move(Conditions.front());
- Conditions.erase(Conditions.begin());
- return P;
- }
+ std::unique_ptr<PredicateMatcher> 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<PredicateMatcher> Condition = nullptr;
+ std::unique_ptr<PredicateMatcher> 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<SMLoc> SrcLoc) : SrcLoc(SrcLoc), RuleID(NextRuleID++) {}
+ RuleMatcher(ArrayRef<SMLoc> 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 PredicateTy> class PredicateListMatcher {
More information about the llvm-branch-commits
mailing list