From 33fe0182f3623d0df6bb88a2fd83f48c6c561a6b Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 11 Apr 2015 15:58:30 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234689 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/RecordLayout.h | 2 +- include/clang/ASTMatchers/Dynamic/VariantValue.h | 2 +- include/clang/Analysis/Analyses/LiveVariables.h | 2 -- include/clang/Analysis/CFG.h | 1 - include/clang/Basic/SourceManagerInternals.h | 5 ----- include/clang/Lex/MacroArgs.h | 3 ++- include/clang/Lex/MacroInfo.h | 2 +- include/clang/Sema/CodeCompleteConsumer.h | 2 +- .../clang/StaticAnalyzer/Core/PathSensitive/Environment.h | 1 - .../StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h | 2 -- .../StaticAnalyzer/Core/PathSensitive/SymbolManager.h | 2 -- lib/CodeGen/CGObjCMac.cpp | 3 --- lib/Index/SimpleFormatContext.h | 2 -- lib/Rewrite/RewriteRope.cpp | 4 ++-- utils/TableGen/NeonEmitter.cpp | 8 -------- 15 files changed, 8 insertions(+), 33 deletions(-) diff --git a/include/clang/AST/RecordLayout.h b/include/clang/AST/RecordLayout.h index f9240f2b48..667f23520e 100644 --- a/include/clang/AST/RecordLayout.h +++ b/include/clang/AST/RecordLayout.h @@ -159,7 +159,7 @@ private: const BaseOffsetsMapTy& BaseOffsets, const VBaseOffsetsMapTy& VBaseOffsets); - ~ASTRecordLayout() {} + ~ASTRecordLayout() = default; void Destroy(ASTContext &Ctx); diff --git a/include/clang/ASTMatchers/Dynamic/VariantValue.h b/include/clang/ASTMatchers/Dynamic/VariantValue.h index bf69e17088..78aa9dc82a 100644 --- a/include/clang/ASTMatchers/Dynamic/VariantValue.h +++ b/include/clang/ASTMatchers/Dynamic/VariantValue.h @@ -111,7 +111,7 @@ class VariantMatcher { ArrayRef InnerMatchers) const; protected: - ~MatcherOps() {} + ~MatcherOps() = default; private: ast_type_traits::ASTNodeKind NodeKind; diff --git a/include/clang/Analysis/Analyses/LiveVariables.h b/include/clang/Analysis/Analyses/LiveVariables.h index 7d11091435..e17f73a61f 100644 --- a/include/clang/Analysis/Analyses/LiveVariables.h +++ b/include/clang/Analysis/Analyses/LiveVariables.h @@ -44,8 +44,6 @@ public: llvm::ImmutableSet LiveDecls) : liveStmts(LiveStmts), liveDecls(LiveDecls) {} - ~LivenessValues() {} - bool isLive(const Stmt *S) const; bool isLive(const VarDecl *D) const; diff --git a/include/clang/Analysis/CFG.h b/include/clang/Analysis/CFG.h index 3fddbb90fe..e7f6383626 100644 --- a/include/clang/Analysis/CFG.h +++ b/include/clang/Analysis/CFG.h @@ -493,7 +493,6 @@ public: : Elements(C), Label(nullptr), Terminator(nullptr), LoopTarget(nullptr), BlockID(blockid), Preds(C, 1), Succs(C, 1), HasNoReturnElement(false), Parent(parent) {} - ~CFGBlock() {} // Statement iterators typedef ElementList::iterator iterator; diff --git a/include/clang/Basic/SourceManagerInternals.h b/include/clang/Basic/SourceManagerInternals.h index f31d604244..27dea9f84b 100644 --- a/include/clang/Basic/SourceManagerInternals.h +++ b/include/clang/Basic/SourceManagerInternals.h @@ -88,17 +88,12 @@ class LineTableInfo { /// at which they occur in the file). std::map > LineEntries; public: - LineTableInfo() { - } - void clear() { FilenameIDs.clear(); FilenamesByID.clear(); LineEntries.clear(); } - ~LineTableInfo() {} - unsigned getLineTableFilenameID(StringRef Str); const char *getFilename(unsigned ID) const { assert(ID < FilenamesByID.size() && "Invalid FilenameID"); diff --git a/include/clang/Lex/MacroArgs.h b/include/clang/Lex/MacroArgs.h index d858ec2b42..243b143f7a 100644 --- a/include/clang/Lex/MacroArgs.h +++ b/include/clang/Lex/MacroArgs.h @@ -56,7 +56,8 @@ class MacroArgs { MacroArgs(unsigned NumToks, bool varargsElided) : NumUnexpArgTokens(NumToks), VarargsElided(varargsElided), ArgCache(nullptr) {} - ~MacroArgs() {} + ~MacroArgs() = default; + public: /// MacroArgs ctor function - Create a new MacroArgs object with the specified /// macro and argument info. diff --git a/include/clang/Lex/MacroInfo.h b/include/clang/Lex/MacroInfo.h index 8a113cbbe7..253e662586 100644 --- a/include/clang/Lex/MacroInfo.h +++ b/include/clang/Lex/MacroInfo.h @@ -109,7 +109,7 @@ class MacroInfo { // Only the Preprocessor gets to create and destroy these. MacroInfo(SourceLocation DefLoc); - ~MacroInfo() {} + ~MacroInfo() = default; public: /// \brief Return the location that the macro was defined at. diff --git a/include/clang/Sema/CodeCompleteConsumer.h b/include/clang/Sema/CodeCompleteConsumer.h index d24a925dd8..de65c43c76 100644 --- a/include/clang/Sema/CodeCompleteConsumer.h +++ b/include/clang/Sema/CodeCompleteConsumer.h @@ -449,7 +449,7 @@ private: const char **Annotations, unsigned NumAnnotations, StringRef ParentName, const char *BriefComment); - ~CodeCompletionString() { } + ~CodeCompletionString() = default; friend class CodeCompletionBuilder; friend class CodeCompletionResult; diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h b/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h index ba9715b38f..cc3779d743 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h @@ -106,7 +106,6 @@ private: public: EnvironmentManager(llvm::BumpPtrAllocator& Allocator) : F(Allocator) {} - ~EnvironmentManager() {} Environment getInitialEnvironment() { return Environment(F.getEmptyMap()); diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h index c4eabb8c2a..cfb1b921e9 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h @@ -127,8 +127,6 @@ public: : Location(loc), State(state), Succs(IsSink) { assert(isSink() == IsSink); } - - ~ExplodedNode() {} /// getLocation - Returns the edge associated with the given node. ProgramPoint getLocation() const { return Location; } diff --git a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h index 357fc32c7d..1ca96a2231 100644 --- a/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h +++ b/include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h @@ -589,8 +589,6 @@ public: : LCtx(Ctx), Loc(s), SymMgr(symmgr), reapedStore(nullptr, storeMgr) {} - ~SymbolReaper() {} - const LocationContext *getLocationContext() const { return LCtx; } bool isLive(SymbolRef sym); diff --git a/lib/CodeGen/CGObjCMac.cpp b/lib/CodeGen/CGObjCMac.cpp index 587731db8b..a45446a706 100644 --- a/lib/CodeGen/CGObjCMac.cpp +++ b/lib/CodeGen/CGObjCMac.cpp @@ -486,7 +486,6 @@ public: } ObjCCommonTypesHelper(CodeGen::CodeGenModule &cgm); - ~ObjCCommonTypesHelper(){} }; /// ObjCTypesHelper - Helper class that encapsulates lazy @@ -595,7 +594,6 @@ public: public: ObjCTypesHelper(CodeGen::CodeGenModule &cgm); - ~ObjCTypesHelper() {} }; /// ObjCNonFragileABITypesHelper - will have all types needed by objective-c's @@ -733,7 +731,6 @@ public: llvm::Type *EHTypePtrTy; ObjCNonFragileABITypesHelper(CodeGen::CodeGenModule &cgm); - ~ObjCNonFragileABITypesHelper(){} }; class CGObjCCommonMac : public CodeGen::CGObjCRuntime { diff --git a/lib/Index/SimpleFormatContext.h b/lib/Index/SimpleFormatContext.h index 080a4ad04d..b884214989 100644 --- a/lib/Index/SimpleFormatContext.h +++ b/lib/Index/SimpleFormatContext.h @@ -44,8 +44,6 @@ public: Diagnostics->setClient(new IgnoringDiagConsumer, true); } - ~SimpleFormatContext() { } - FileID createInMemoryFile(StringRef Name, StringRef Content) { std::unique_ptr Source = llvm::MemoryBuffer::getMemBuffer(Content); diff --git a/lib/Rewrite/RewriteRope.cpp b/lib/Rewrite/RewriteRope.cpp index 1c82ee4a67..451ad07e4e 100644 --- a/lib/Rewrite/RewriteRope.cpp +++ b/lib/Rewrite/RewriteRope.cpp @@ -89,9 +89,9 @@ namespace { bool IsLeaf; RopePieceBTreeNode(bool isLeaf) : Size(0), IsLeaf(isLeaf) {} - ~RopePieceBTreeNode() {} - public: + ~RopePieceBTreeNode() = default; + public: bool isLeaf() const { return IsLeaf; } unsigned size() const { return Size; } diff --git a/utils/TableGen/NeonEmitter.cpp b/utils/TableGen/NeonEmitter.cpp index d46785d193..2a857a87ef 100644 --- a/utils/TableGen/NeonEmitter.cpp +++ b/utils/TableGen/NeonEmitter.cpp @@ -1563,8 +1563,6 @@ std::pair Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ // See the documentation in arm_neon.td for a description of these operators. class LowHalf : public SetTheory::Operator { public: - void anchor() override {} - ~LowHalf() override {} void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, ArrayRef Loc) override { SetTheory::RecSet Elts2; @@ -1574,8 +1572,6 @@ std::pair Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ }; class HighHalf : public SetTheory::Operator { public: - void anchor() override {} - ~HighHalf() override {} void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, ArrayRef Loc) override { SetTheory::RecSet Elts2; @@ -1588,8 +1584,6 @@ std::pair Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ public: Rev(unsigned ElementSize) : ElementSize(ElementSize) {} - void anchor() override {} - ~Rev() override {} void apply(SetTheory &ST, DagInit *Expr, SetTheory::RecSet &Elts, ArrayRef Loc) override { SetTheory::RecSet Elts2; @@ -1613,8 +1607,6 @@ std::pair Intrinsic::DagEmitter::emitDagShuffle(DagInit *DI){ public: MaskExpander(unsigned N) : N(N) {} - void anchor() override {} - ~MaskExpander() override {} void expand(SetTheory &ST, Record *R, SetTheory::RecSet &Elts) override { unsigned Addend = 0; if (R->getName() == "mask0") -- 2.40.0