Skip to content

Commit dd0ff85

Browse files
committed
Remove empty non-virtual destructors or mark them =default when non-public
These add no value but can make a class non-trivially copyable. NFC. llvm-svn: 234688
1 parent 7b24b05 commit dd0ff85

File tree

17 files changed

+37
-60
lines changed

17 files changed

+37
-60
lines changed

llvm/include/llvm/Analysis/RegionInfo.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,8 +820,6 @@ class RegionNode : public RegionNodeBase<RegionTraits<Function>> {
820820
inline RegionNode(Region *Parent, BasicBlock *Entry, bool isSubRegion = false)
821821
: RegionNodeBase<RegionTraits<Function>>(Parent, Entry, isSubRegion) {}
822822

823-
~RegionNode() {}
824-
825823
bool operator==(const Region &RN) const {
826824
return this == reinterpret_cast<const RegionNode *>(&RN);
827825
}

llvm/include/llvm/Bitcode/BitCodes.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ template <> struct isPodLike<BitCodeAbbrevOp> { static const bool value=true; };
164164
/// specialized format instead of the fully-general, fully-vbr, format.
165165
class BitCodeAbbrev : public RefCountedBase<BitCodeAbbrev> {
166166
SmallVector<BitCodeAbbrevOp, 32> OperandList;
167-
~BitCodeAbbrev() {}
168167
// Only RefCountedBase is allowed to delete.
168+
~BitCodeAbbrev() = default;
169169
friend class RefCountedBase<BitCodeAbbrev>;
170170

171171
public:

llvm/include/llvm/CodeGen/MachineRegionInfo.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ class MachineRegionNode : public RegionNodeBase<RegionTraits<MachineFunction>> {
5757

5858
}
5959

60-
~MachineRegionNode() { }
61-
6260
bool operator==(const MachineRegion &RN) const {
6361
return this == reinterpret_cast<const MachineRegionNode*>(&RN);
6462
}

llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class DWARFUnitSectionBase {
4646
const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS,
4747
StringRef SOS, StringRef AOS, bool isLittleEndian) = 0;
4848

49-
~DWARFUnitSectionBase() {}
49+
~DWARFUnitSectionBase() = default;
5050
};
5151

5252
/// Concrete instance of DWARFUnitSection, specialized for one Unit type.

llvm/include/llvm/IR/DebugInfoMetadata.h

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class DebugNode : public MDNode {
152152
assert(Tag < 1u << 16);
153153
SubclassData16 = Tag;
154154
}
155-
~DebugNode() {}
155+
~DebugNode() = default;
156156

157157
template <class Ty> Ty *getOperandAs(unsigned I) const {
158158
return cast_or_null<Ty>(getOperand(I));
@@ -328,7 +328,7 @@ class MDSubrange : public DebugNode {
328328
: DebugNode(C, MDSubrangeKind, Storage, dwarf::DW_TAG_subrange_type,
329329
None),
330330
Count(Count), LowerBound(LowerBound) {}
331-
~MDSubrange() {}
331+
~MDSubrange() = default;
332332

333333
static MDSubrange *getImpl(LLVMContext &Context, int64_t Count,
334334
int64_t LowerBound, StorageType Storage,
@@ -366,7 +366,7 @@ class MDEnumerator : public DebugNode {
366366
ArrayRef<Metadata *> Ops)
367367
: DebugNode(C, MDEnumeratorKind, Storage, dwarf::DW_TAG_enumerator, Ops),
368368
Value(Value) {}
369-
~MDEnumerator() {}
369+
~MDEnumerator() = default;
370370

371371
static MDEnumerator *getImpl(LLVMContext &Context, int64_t Value,
372372
StringRef Name, StorageType Storage,
@@ -411,7 +411,7 @@ class MDScope : public DebugNode {
411411
MDScope(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
412412
ArrayRef<Metadata *> Ops)
413413
: DebugNode(C, ID, Storage, Tag, Ops) {}
414-
~MDScope() {}
414+
~MDScope() = default;
415415

416416
public:
417417
MDFile *getFile() const { return cast_or_null<MDFile>(getRawFile()); }
@@ -461,7 +461,7 @@ class MDFile : public MDScope {
461461

462462
MDFile(LLVMContext &C, StorageType Storage, ArrayRef<Metadata *> Ops)
463463
: MDScope(C, MDFileKind, Storage, dwarf::DW_TAG_file_type, Ops) {}
464-
~MDFile() {}
464+
~MDFile() = default;
465465

466466
static MDFile *getImpl(LLVMContext &Context, StringRef Filename,
467467
StringRef Directory, StorageType Storage,
@@ -528,7 +528,7 @@ class MDType : public MDScope {
528528
: MDScope(C, ID, Storage, Tag, Ops), Line(Line), Flags(Flags),
529529
SizeInBits(SizeInBits), AlignInBits(AlignInBits),
530530
OffsetInBits(OffsetInBits) {}
531-
~MDType() {}
531+
~MDType() = default;
532532

533533
public:
534534
TempMDType clone() const {
@@ -607,7 +607,7 @@ class MDBasicType : public MDType {
607607
: MDType(C, MDBasicTypeKind, Storage, Tag, 0, SizeInBits, AlignInBits, 0,
608608
0, Ops),
609609
Encoding(Encoding) {}
610-
~MDBasicType() {}
610+
~MDBasicType() = default;
611611

612612
static MDBasicType *getImpl(LLVMContext &Context, unsigned Tag,
613613
StringRef Name, uint64_t SizeInBits,
@@ -658,7 +658,7 @@ class MDDerivedTypeBase : public MDType {
658658
ArrayRef<Metadata *> Ops)
659659
: MDType(C, ID, Storage, Tag, Line, SizeInBits, AlignInBits, OffsetInBits,
660660
Flags, Ops) {}
661-
~MDDerivedTypeBase() {}
661+
~MDDerivedTypeBase() = default;
662662

663663
public:
664664
MDTypeRef getBaseType() const { return MDTypeRef(getRawBaseType()); }
@@ -686,7 +686,7 @@ class MDDerivedType : public MDDerivedTypeBase {
686686
uint64_t OffsetInBits, unsigned Flags, ArrayRef<Metadata *> Ops)
687687
: MDDerivedTypeBase(C, MDDerivedTypeKind, Storage, Tag, Line, SizeInBits,
688688
AlignInBits, OffsetInBits, Flags, Ops) {}
689-
~MDDerivedType() {}
689+
~MDDerivedType() = default;
690690

691691
static MDDerivedType *getImpl(LLVMContext &Context, unsigned Tag,
692692
StringRef Name, MDFile *File, unsigned Line,
@@ -763,7 +763,7 @@ class MDCompositeTypeBase : public MDDerivedTypeBase {
763763
: MDDerivedTypeBase(C, ID, Storage, Tag, Line, SizeInBits, AlignInBits,
764764
OffsetInBits, Flags, Ops),
765765
RuntimeLang(RuntimeLang) {}
766-
~MDCompositeTypeBase() {}
766+
~MDCompositeTypeBase() = default;
767767

768768
public:
769769
DebugNodeArray getElements() const {
@@ -824,7 +824,7 @@ class MDCompositeType : public MDCompositeTypeBase {
824824
: MDCompositeTypeBase(C, MDCompositeTypeKind, Storage, Tag, Line,
825825
RuntimeLang, SizeInBits, AlignInBits, OffsetInBits,
826826
Flags, Ops) {}
827-
~MDCompositeType() {}
827+
~MDCompositeType() = default;
828828

829829
static MDCompositeType *
830830
getImpl(LLVMContext &Context, unsigned Tag, StringRef Name, Metadata *File,
@@ -907,7 +907,7 @@ class MDSubroutineType : public MDCompositeTypeBase {
907907
: MDCompositeTypeBase(C, MDSubroutineTypeKind, Storage,
908908
dwarf::DW_TAG_subroutine_type, 0, 0, 0, 0, 0, Flags,
909909
Ops) {}
910-
~MDSubroutineType() {}
910+
~MDSubroutineType() = default;
911911

912912
static MDSubroutineType *getImpl(LLVMContext &Context, unsigned Flags,
913913
MDTypeRefArray TypeArray,
@@ -958,7 +958,7 @@ class MDCompileUnit : public MDScope {
958958
: MDScope(C, MDCompileUnitKind, Storage, dwarf::DW_TAG_compile_unit, Ops),
959959
SourceLanguage(SourceLanguage), IsOptimized(IsOptimized),
960960
RuntimeVersion(RuntimeVersion), EmissionKind(EmissionKind) {}
961-
~MDCompileUnit() {}
961+
~MDCompileUnit() = default;
962962

963963
static MDCompileUnit *
964964
getImpl(LLVMContext &Context, unsigned SourceLanguage, MDFile *File,
@@ -1083,7 +1083,7 @@ class MDLocalScope : public MDScope {
10831083
MDLocalScope(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
10841084
ArrayRef<Metadata *> Ops)
10851085
: MDScope(C, ID, Storage, Tag, Ops) {}
1086-
~MDLocalScope() {}
1086+
~MDLocalScope() = default;
10871087

10881088
public:
10891089
/// \brief Get the subprogram for this scope.
@@ -1221,7 +1221,7 @@ class MDSubprogram : public MDLocalScope {
12211221
Line(Line), ScopeLine(ScopeLine), Virtuality(Virtuality),
12221222
VirtualIndex(VirtualIndex), Flags(Flags), IsLocalToUnit(IsLocalToUnit),
12231223
IsDefinition(IsDefinition), IsOptimized(IsOptimized) {}
1224-
~MDSubprogram() {}
1224+
~MDSubprogram() = default;
12251225

12261226
static MDSubprogram *
12271227
getImpl(LLVMContext &Context, MDScopeRef Scope, StringRef Name,
@@ -1383,7 +1383,7 @@ class MDLexicalBlockBase : public MDLocalScope {
13831383
MDLexicalBlockBase(LLVMContext &C, unsigned ID, StorageType Storage,
13841384
ArrayRef<Metadata *> Ops)
13851385
: MDLocalScope(C, ID, Storage, dwarf::DW_TAG_lexical_block, Ops) {}
1386-
~MDLexicalBlockBase() {}
1386+
~MDLexicalBlockBase() = default;
13871387

13881388
public:
13891389
MDLocalScope *getScope() const { return cast<MDLocalScope>(getRawScope()); }
@@ -1407,7 +1407,7 @@ class MDLexicalBlock : public MDLexicalBlockBase {
14071407
unsigned Column, ArrayRef<Metadata *> Ops)
14081408
: MDLexicalBlockBase(C, MDLexicalBlockKind, Storage, Ops), Line(Line),
14091409
Column(Column) {}
1410-
~MDLexicalBlock() {}
1410+
~MDLexicalBlock() = default;
14111411

14121412
static MDLexicalBlock *getImpl(LLVMContext &Context, MDLocalScope *Scope,
14131413
MDFile *File, unsigned Line, unsigned Column,
@@ -1455,7 +1455,7 @@ class MDLexicalBlockFile : public MDLexicalBlockBase {
14551455
unsigned Discriminator, ArrayRef<Metadata *> Ops)
14561456
: MDLexicalBlockBase(C, MDLexicalBlockFileKind, Storage, Ops),
14571457
Discriminator(Discriminator) {}
1458-
~MDLexicalBlockFile() {}
1458+
~MDLexicalBlockFile() = default;
14591459

14601460
static MDLexicalBlockFile *getImpl(LLVMContext &Context, MDLocalScope *Scope,
14611461
MDFile *File, unsigned Discriminator,
@@ -1504,7 +1504,7 @@ class MDNamespace : public MDScope {
15041504
: MDScope(Context, MDNamespaceKind, Storage, dwarf::DW_TAG_namespace,
15051505
Ops),
15061506
Line(Line) {}
1507-
~MDNamespace() {}
1507+
~MDNamespace() = default;
15081508

15091509
static MDNamespace *getImpl(LLVMContext &Context, MDScope *Scope,
15101510
MDFile *File, StringRef Name, unsigned Line,
@@ -1549,7 +1549,7 @@ class MDTemplateParameter : public DebugNode {
15491549
MDTemplateParameter(LLVMContext &Context, unsigned ID, StorageType Storage,
15501550
unsigned Tag, ArrayRef<Metadata *> Ops)
15511551
: DebugNode(Context, ID, Storage, Tag, Ops) {}
1552-
~MDTemplateParameter() {}
1552+
~MDTemplateParameter() = default;
15531553

15541554
public:
15551555
StringRef getName() const { return getStringOperand(0); }
@@ -1572,7 +1572,7 @@ class MDTemplateTypeParameter : public MDTemplateParameter {
15721572
ArrayRef<Metadata *> Ops)
15731573
: MDTemplateParameter(Context, MDTemplateTypeParameterKind, Storage,
15741574
dwarf::DW_TAG_template_type_parameter, Ops) {}
1575-
~MDTemplateTypeParameter() {}
1575+
~MDTemplateTypeParameter() = default;
15761576

15771577
static MDTemplateTypeParameter *getImpl(LLVMContext &Context, StringRef Name,
15781578
MDTypeRef Type, StorageType Storage,
@@ -1609,7 +1609,7 @@ class MDTemplateValueParameter : public MDTemplateParameter {
16091609
unsigned Tag, ArrayRef<Metadata *> Ops)
16101610
: MDTemplateParameter(Context, MDTemplateValueParameterKind, Storage, Tag,
16111611
Ops) {}
1612-
~MDTemplateValueParameter() {}
1612+
~MDTemplateValueParameter() = default;
16131613

16141614
static MDTemplateValueParameter *getImpl(LLVMContext &Context, unsigned Tag,
16151615
StringRef Name, MDTypeRef Type,
@@ -1655,7 +1655,7 @@ class MDVariable : public DebugNode {
16551655
MDVariable(LLVMContext &C, unsigned ID, StorageType Storage, unsigned Tag,
16561656
unsigned Line, ArrayRef<Metadata *> Ops)
16571657
: DebugNode(C, ID, Storage, Tag, Ops), Line(Line) {}
1658-
~MDVariable() {}
1658+
~MDVariable() = default;
16591659

16601660
public:
16611661
unsigned getLine() const { return Line; }
@@ -1702,7 +1702,7 @@ class MDGlobalVariable : public MDVariable {
17021702
: MDVariable(C, MDGlobalVariableKind, Storage, dwarf::DW_TAG_variable,
17031703
Line, Ops),
17041704
IsLocalToUnit(IsLocalToUnit), IsDefinition(IsDefinition) {}
1705-
~MDGlobalVariable() {}
1705+
~MDGlobalVariable() = default;
17061706

17071707
static MDGlobalVariable *
17081708
getImpl(LLVMContext &Context, MDScope *Scope, StringRef Name,
@@ -1785,7 +1785,7 @@ class MDLocalVariable : public MDVariable {
17851785
ArrayRef<Metadata *> Ops)
17861786
: MDVariable(C, MDLocalVariableKind, Storage, Tag, Line, Ops), Arg(Arg),
17871787
Flags(Flags) {}
1788-
~MDLocalVariable() {}
1788+
~MDLocalVariable() = default;
17891789

17901790
static MDLocalVariable *getImpl(LLVMContext &Context, unsigned Tag,
17911791
MDScope *Scope, StringRef Name, MDFile *File,
@@ -1882,7 +1882,7 @@ class MDExpression : public MDNode {
18821882
MDExpression(LLVMContext &C, StorageType Storage, ArrayRef<uint64_t> Elements)
18831883
: MDNode(C, MDExpressionKind, Storage, None),
18841884
Elements(Elements.begin(), Elements.end()) {}
1885-
~MDExpression() {}
1885+
~MDExpression() = default;
18861886

18871887
static MDExpression *getImpl(LLVMContext &Context,
18881888
ArrayRef<uint64_t> Elements, StorageType Storage,
@@ -2021,7 +2021,7 @@ class MDObjCProperty : public DebugNode {
20212021
: DebugNode(C, MDObjCPropertyKind, Storage, dwarf::DW_TAG_APPLE_property,
20222022
Ops),
20232023
Line(Line), Attributes(Attributes) {}
2024-
~MDObjCProperty() {}
2024+
~MDObjCProperty() = default;
20252025

20262026
static MDObjCProperty *
20272027
getImpl(LLVMContext &Context, StringRef Name, MDFile *File, unsigned Line,
@@ -2099,7 +2099,7 @@ class MDImportedEntity : public DebugNode {
20992099
MDImportedEntity(LLVMContext &C, StorageType Storage, unsigned Tag,
21002100
unsigned Line, ArrayRef<Metadata *> Ops)
21012101
: DebugNode(C, MDImportedEntityKind, Storage, Tag, Ops), Line(Line) {}
2102-
~MDImportedEntity() {}
2102+
~MDImportedEntity() = default;
21032103

21042104
static MDImportedEntity *getImpl(LLVMContext &Context, unsigned Tag,
21052105
MDScope *Scope, DebugNodeRef Entity,

llvm/include/llvm/IR/Metadata.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class Metadata {
8989
Metadata(unsigned ID, StorageType Storage)
9090
: SubclassID(ID), Storage(Storage), SubclassData16(0), SubclassData32(0) {
9191
}
92-
~Metadata() {}
92+
~Metadata() = default;
9393

9494
/// \brief Default handling of a changed operand, which asserts.
9595
///
@@ -253,7 +253,7 @@ class ValueAsMetadata : public Metadata, ReplaceableMetadataImpl {
253253
: Metadata(ID, Uniqued), ReplaceableMetadataImpl(V->getContext()), V(V) {
254254
assert(V && "Expected valid value");
255255
}
256-
~ValueAsMetadata() {}
256+
~ValueAsMetadata() = default;
257257

258258
public:
259259
static ValueAsMetadata *get(Value *V);
@@ -754,7 +754,7 @@ class MDNode : public Metadata {
754754

755755
MDNode(LLVMContext &Context, unsigned ID, StorageType Storage,
756756
ArrayRef<Metadata *> Ops1, ArrayRef<Metadata *> Ops2 = None);
757-
~MDNode() {}
757+
~MDNode() = default;
758758

759759
void dropAllReferences();
760760

llvm/include/llvm/IR/Type.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ class Type {
9191
NumContainedTys(0), ContainedTys(nullptr) {
9292
setTypeID(tid);
9393
}
94-
~Type() {}
95-
94+
~Type() = default;
95+
9696
void setTypeID(TypeID ID) {
9797
IDAndSubclassData = (ID & 0xFF) | (IDAndSubclassData & 0xFFFFFF00);
9898
assert(getTypeID() == ID && "TypeID data too large for field");

llvm/include/llvm/IR/ValueMap.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ class ValueMap {
9999
explicit ValueMap(const ExtraData &Data, unsigned NumInitBuckets = 64)
100100
: Map(NumInitBuckets), Data(Data) {}
101101

102-
~ValueMap() {}
103-
104102
bool hasMD() const { return MDMap; }
105103
MDMapT &MD() {
106104
if (!MDMap)

llvm/include/llvm/MC/ConstantPools.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ class AssemblerConstantPools {
7777
ConstantPoolMapTy ConstantPools;
7878

7979
public:
80-
AssemblerConstantPools() {}
81-
~AssemblerConstantPools() {}
82-
8380
void emitAll(MCStreamer &Streamer);
8481
void emitForCurrentSection(MCStreamer &Streamer);
8582
const MCExpr *addEntry(MCStreamer &Streamer, const MCExpr *Expr,

llvm/include/llvm/MC/MCTargetAsmParser.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ struct ParseInstructionInfo {
7575
ParseInstructionInfo() : AsmRewrites(nullptr) {}
7676
ParseInstructionInfo(SmallVectorImpl<AsmRewrite> *rewrites)
7777
: AsmRewrites(rewrites) {}
78-
79-
~ParseInstructionInfo() {}
8078
};
8179

8280
/// MCTargetAsmParser - Generic interface to target specific assembly parsers.

llvm/include/llvm/TableGen/Record.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,8 +1442,6 @@ class Record {
14421442
TheInit(O.TheInit), IsAnonymous(O.IsAnonymous),
14431443
ResolveFirst(O.ResolveFirst) { }
14441444

1445-
~Record() {}
1446-
14471445
static unsigned getNewUID() { return LastID++; }
14481446

14491447
unsigned getID() const { return ID; }

llvm/include/llvm/Transforms/Utils/SymbolRewriter.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ typedef iplist<RewriteDescriptor> RewriteDescriptorList;
9090

9191
class RewriteMapParser {
9292
public:
93-
RewriteMapParser() {}
94-
~RewriteMapParser() {}
95-
9693
bool parse(const std::string &MapFile, RewriteDescriptorList *Descriptors);
9794

9895
private:

llvm/lib/AsmParser/LLLexer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ namespace llvm {
4545
public:
4646
explicit LLLexer(StringRef StartBuf, SourceMgr &SM, SMDiagnostic &,
4747
LLVMContext &C);
48-
~LLLexer() {}
4948

5049
lltok::Kind Lex() {
5150
return CurKind = LexToken();

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,6 @@ class SelectionDAGBuilder {
397397
StackProtectorDescriptor() : ParentMBB(nullptr), SuccessMBB(nullptr),
398398
FailureMBB(nullptr), Guard(nullptr),
399399
GuardReg(0) { }
400-
~StackProtectorDescriptor() { }
401400

402401
/// Returns true if all fields of the stack protector descriptor are
403402
/// initialized implying that we should/are ready to emit a stack protector.

0 commit comments

Comments
 (0)