Author: jlebar Date: Thu Dec 29 13:59:26 2016 New Revision: 290717 URL: http://llvm.org/viewvc/llvm-project?rev=290717&view=rev Log: [ADT] Delete RefCountedBaseVPTR.
Summary: This class is unnecessary. Its comment indicated that it was a compile error to allocate an instance of a class that inherits from RefCountedBaseVPTR on the stack. This may have been true at one point, but it's not today. Moreover you really do not want to allocate *any* refcounted object on the stack, vptrs or not, so if we did have a way to prevent these objects from being stack-allocated, we'd want to apply it to regular RefCountedBase too, obviating the need for a separate RefCountedBaseVPTR class. It seems that the main way RefCountedBaseVPTR provides safety is by making its subclass's destructor virtual. This may have been helpful at one point, but these days clang will emit an error if you define a class with virtual functions that inherits from RefCountedBase but doesn't have a virtual destructor. Reviewers: compnerd, dblaikie Subscribers: cfe-commits, klimek, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D28162 Modified: cfe/trunk/include/clang/ASTMatchers/Dynamic/VariantValue.h cfe/trunk/include/clang/Basic/LLVM.h cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Modified: cfe/trunk/include/clang/ASTMatchers/Dynamic/VariantValue.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/Dynamic/VariantValue.h?rev=290717&r1=290716&r2=290717&view=diff ============================================================================== --- cfe/trunk/include/clang/ASTMatchers/Dynamic/VariantValue.h (original) +++ cfe/trunk/include/clang/ASTMatchers/Dynamic/VariantValue.h Thu Dec 29 13:59:26 2016 @@ -119,9 +119,9 @@ class VariantMatcher { /// \brief Payload interface to be specialized by each matcher type. /// /// It follows a similar interface as VariantMatcher itself. - class Payload : public RefCountedBaseVPTR { + class Payload : public RefCountedBase<Payload> { public: - ~Payload() override; + virtual ~Payload(); virtual llvm::Optional<DynTypedMatcher> getSingleMatcher() const = 0; virtual std::string getTypeAsString() const = 0; virtual llvm::Optional<DynTypedMatcher> Modified: cfe/trunk/include/clang/Basic/LLVM.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LLVM.h?rev=290717&r1=290716&r2=290717&view=diff ============================================================================== --- cfe/trunk/include/clang/Basic/LLVM.h (original) +++ cfe/trunk/include/clang/Basic/LLVM.h Thu Dec 29 13:59:26 2016 @@ -43,7 +43,6 @@ namespace llvm { template <typename T> class IntrusiveRefCntPtr; template <typename T> struct IntrusiveRefCntPtrInfo; template <class Derived> class RefCountedBase; - class RefCountedBaseVPTR; class raw_ostream; class raw_pwrite_stream; @@ -76,7 +75,6 @@ namespace clang { using llvm::IntrusiveRefCntPtr; using llvm::IntrusiveRefCntPtrInfo; using llvm::RefCountedBase; - using llvm::RefCountedBaseVPTR; using llvm::raw_ostream; using llvm::raw_pwrite_stream; Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h?rev=290717&r1=290716&r2=290717&view=diff ============================================================================== --- cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h (original) +++ cfe/trunk/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h Thu Dec 29 13:59:26 2016 @@ -334,7 +334,7 @@ public: // Path "pieces" for path-sensitive diagnostics. //===----------------------------------------------------------------------===// -class PathDiagnosticPiece : public RefCountedBaseVPTR { +class PathDiagnosticPiece : public RefCountedBase<PathDiagnosticPiece> { public: enum Kind { ControlFlow, Event, Macro, Call, Note }; enum DisplayHint { Above, Below }; @@ -366,7 +366,7 @@ protected: PathDiagnosticPiece(Kind k, DisplayHint hint = Below); public: - ~PathDiagnosticPiece() override; + virtual ~PathDiagnosticPiece(); StringRef getString() const { return str; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits