[PDB] Remove all clone() methods.
authorZachary Turner <zturner@google.com>
Wed, 12 Sep 2018 22:57:03 +0000 (22:57 +0000)
committerZachary Turner <zturner@google.com>
Wed, 12 Sep 2018 22:57:03 +0000 (22:57 +0000)
These are dead code and encourage poor usage patterns, so I'm
removing them.  They weren't called anywhere anyway.

llvm-svn: 342093

39 files changed:
llvm/include/llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h
llvm/include/llvm/DebugInfo/PDB/DIA/DIADataStream.h
llvm/include/llvm/DebugInfo/PDB/DIA/DIAEnumDebugStreams.h
llvm/include/llvm/DebugInfo/PDB/DIA/DIAEnumInjectedSources.h
llvm/include/llvm/DebugInfo/PDB/DIA/DIAEnumLineNumbers.h
llvm/include/llvm/DebugInfo/PDB/DIA/DIAEnumSectionContribs.h
llvm/include/llvm/DebugInfo/PDB/DIA/DIAEnumSourceFiles.h
llvm/include/llvm/DebugInfo/PDB/DIA/DIAEnumSymbols.h
llvm/include/llvm/DebugInfo/PDB/DIA/DIAEnumTables.h
llvm/include/llvm/DebugInfo/PDB/IPDBDataStream.h
llvm/include/llvm/DebugInfo/PDB/IPDBEnumChildren.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeCompilandSymbol.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumModules.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeEnumTypes.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeExeSymbol.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeRawSymbol.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeBuiltin.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypeEnum.h
llvm/include/llvm/DebugInfo/PDB/Native/NativeTypePointer.h
llvm/include/llvm/DebugInfo/PDB/PDBSymbol.h
llvm/include/llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h
llvm/lib/DebugInfo/PDB/DIA/DIADataStream.cpp
llvm/lib/DebugInfo/PDB/DIA/DIAEnumDebugStreams.cpp
llvm/lib/DebugInfo/PDB/DIA/DIAEnumInjectedSources.cpp
llvm/lib/DebugInfo/PDB/DIA/DIAEnumLineNumbers.cpp
llvm/lib/DebugInfo/PDB/DIA/DIAEnumSectionContribs.cpp
llvm/lib/DebugInfo/PDB/DIA/DIAEnumSourceFiles.cpp
llvm/lib/DebugInfo/PDB/DIA/DIAEnumSymbols.cpp
llvm/lib/DebugInfo/PDB/DIA/DIAEnumTables.cpp
llvm/lib/DebugInfo/PDB/Native/NativeCompilandSymbol.cpp
llvm/lib/DebugInfo/PDB/Native/NativeEnumModules.cpp
llvm/lib/DebugInfo/PDB/Native/NativeEnumTypes.cpp
llvm/lib/DebugInfo/PDB/Native/NativeExeSymbol.cpp
llvm/lib/DebugInfo/PDB/Native/NativeTypeBuiltin.cpp
llvm/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp
llvm/lib/DebugInfo/PDB/Native/NativeTypePointer.cpp
llvm/lib/DebugInfo/PDB/PDBSymbol.cpp
llvm/lib/DebugInfo/PDB/PDBSymbolFunc.cpp
llvm/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp

index 9713dce..ac7f196 100644 (file)
@@ -43,11 +43,6 @@ public:
 
   void reset() override { Enumerator->reset(); }
 
-  ConcreteSymbolEnumerator<ChildType> *clone() const override {
-    std::unique_ptr<IPDBEnumSymbols> WrappedClone(Enumerator->clone());
-    return new ConcreteSymbolEnumerator<ChildType>(std::move(WrappedClone));
-  }
-
 private:
 
   std::unique_ptr<IPDBEnumSymbols> Enumerator;
index 930bea6..881d732 100644 (file)
@@ -24,7 +24,6 @@ public:
   llvm::Optional<RecordType> getItemAtIndex(uint32_t Index) const override;
   bool getNext(RecordType &Record) override;
   void reset() override;
-  DIADataStream *clone() const override;
 
 private:
   CComPtr<IDiaEnumDebugStreamData> StreamData;
index ffae664..1f12905 100644 (file)
@@ -27,7 +27,6 @@ public:
   ChildTypePtr getChildAtIndex(uint32_t Index) const override;
   ChildTypePtr getNext() override;
   void reset() override;
-  DIAEnumDebugStreams *clone() const override;
 
 private:
   CComPtr<IDiaEnumDebugStreams> Enumerator;
index 39490a4..2fcefec 100644 (file)
@@ -28,7 +28,6 @@ public:
   ChildTypePtr getChildAtIndex(uint32_t Index) const override;
   ChildTypePtr getNext() override;
   void reset() override;
-  DIAEnumInjectedSources *clone() const override;
 
 private:
   const DIASession &Session;
index 08f0de1..f1cb626 100644 (file)
@@ -26,7 +26,6 @@ public:
   ChildTypePtr getChildAtIndex(uint32_t Index) const override;
   ChildTypePtr getNext() override;
   void reset() override;
-  DIAEnumLineNumbers *clone() const override;
 
 private:
   CComPtr<IDiaEnumLineNumbers> Enumerator;
index 52c9563..ac2ae31 100644 (file)
@@ -28,7 +28,6 @@ public:
   ChildTypePtr getChildAtIndex(uint32_t Index) const override;
   ChildTypePtr getNext() override;
   void reset() override;
-  DIAEnumSectionContribs *clone() const override;
 
 private:
   const DIASession &Session;
index e69d18f..dac3df0 100644 (file)
@@ -27,7 +27,6 @@ public:
   ChildTypePtr getChildAtIndex(uint32_t Index) const override;
   ChildTypePtr getNext() override;
   void reset() override;
-  DIAEnumSourceFiles *clone() const override;
 
 private:
   const DIASession &Session;
index f779cd1..9689859 100644 (file)
@@ -27,7 +27,6 @@ public:
   std::unique_ptr<PDBSymbol> getChildAtIndex(uint32_t Index) const override;
   std::unique_ptr<PDBSymbol> getNext() override;
   void reset() override;
-  DIAEnumSymbols *clone() const override;
 
 private:
   const DIASession &Session;
index 926fcfe..f4f856e 100644 (file)
@@ -26,7 +26,6 @@ public:
   std::unique_ptr<IPDBTable> getChildAtIndex(uint32_t Index) const override;
   std::unique_ptr<IPDBTable> getNext() override;
   void reset() override;
-  DIAEnumTables *clone() const override;
 
 private:
   CComPtr<IDiaEnumTables> Enumerator;
index 67b5a06..0d7a286 100644 (file)
@@ -32,7 +32,6 @@ public:
   virtual Optional<RecordType> getItemAtIndex(uint32_t Index) const = 0;
   virtual bool getNext(RecordType &Record) = 0;
   virtual void reset() = 0;
-  virtual IPDBDataStream *clone() const = 0;
 };
 
 } // end namespace pdb
index b6b7d95..e846ffd 100644 (file)
@@ -27,7 +27,6 @@ public:
   virtual ChildTypePtr getChildAtIndex(uint32_t Index) const = 0;
   virtual ChildTypePtr getNext() = 0;
   virtual void reset() = 0;
-  virtual MyType *clone() const = 0;
 };
 
 } // end namespace pdb
index 9a5a35b..e1420fe 100644 (file)
@@ -23,8 +23,6 @@ public:
 
   void dump(raw_ostream &OS, int Indent) const override;
 
-  std::unique_ptr<NativeRawSymbol> clone() const override;
-
   PDB_SymType getSymTag() const override;
   bool isEditAndContinueEnabled() const override;
   SymIndexId getLexicalParentId() const override;
index e213bbe..c268641 100644 (file)
@@ -25,7 +25,6 @@ public:
   std::unique_ptr<PDBSymbol> getChildAtIndex(uint32_t Index) const override;
   std::unique_ptr<PDBSymbol> getNext() override;
   void reset() override;
-  NativeEnumModules *clone() const override;
 
 private:
   NativeSession &Session;
index e0a5c8d..8d1dcec 100644 (file)
@@ -32,7 +32,6 @@ public:
   std::unique_ptr<PDBSymbol> getChildAtIndex(uint32_t Index) const override;
   std::unique_ptr<PDBSymbol> getNext() override;
   void reset() override;
-  NativeEnumTypes *clone() const override;
 
 private:
   NativeEnumTypes(NativeSession &Session,
index 81f0ac0..f4030da 100644 (file)
@@ -25,8 +25,6 @@ class NativeExeSymbol : public NativeRawSymbol {
 public:
   NativeExeSymbol(NativeSession &Session, SymIndexId Id);
 
-  std::unique_ptr<NativeRawSymbol> clone() const override;
-
   std::unique_ptr<IPDBEnumSymbols>
   findChildren(PDB_SymType Type) const override;
 
index adb0418..647654b 100644 (file)
@@ -24,8 +24,6 @@ public:
   NativeRawSymbol(NativeSession &PDBSession, PDB_SymType Tag,
                   SymIndexId SymbolId);
 
-  virtual std::unique_ptr<NativeRawSymbol> clone() const = 0;
-
   void dump(raw_ostream &OS, int Indent) const override;
 
   std::unique_ptr<IPDBEnumSymbols>
index cc44729..571bae8 100644 (file)
@@ -25,8 +25,6 @@ public:
                     uint64_t L);
   ~NativeTypeBuiltin() override;
 
-  virtual std::unique_ptr<NativeRawSymbol> clone() const override;
-
   void dump(raw_ostream &OS, int Indent) const override;
 
   PDB_SymType getSymTag() const override;
index 878da8a..c42726e 100644 (file)
@@ -27,8 +27,6 @@ public:
 
   void dump(raw_ostream &OS, int Indent) const override;
 
-  std::unique_ptr<NativeRawSymbol> clone() const override;
-
   std::unique_ptr<IPDBEnumSymbols>
   findChildren(PDB_SymType Type) const override;
 
index c743335..f504dff 100644 (file)
@@ -27,7 +27,6 @@ public:
   ~NativeTypePointer() override;
 
   void dump(raw_ostream &OS, int Indent) const override;
-  std::unique_ptr<NativeRawSymbol> clone() const override;
 
   bool isConstType() const override;
   uint64_t getLength() const override;
index 9861e81..7f063e2 100644 (file)
@@ -126,8 +126,6 @@ public:
     return Enumerator->getNext();
   }
 
-  std::unique_ptr<PDBSymbol> clone() const;
-
   template <typename T>
   std::unique_ptr<ConcreteSymbolEnumerator<T>> findAllChildren() const {
     auto BaseIter = RawSymbol->findChildren(T::Tag);
index acd97bc..937dd6c 100644 (file)
@@ -25,11 +25,6 @@ namespace pdb {
 class PDBSymbolTypeUDT : public PDBSymbol {
   DECLARE_PDB_SYMBOL_CONCRETE_TYPE(PDB_SymType::UDT)
 public:
-  std::unique_ptr<PDBSymbolTypeUDT> clone() const {
-    return getSession().getConcreteSymbolById<PDBSymbolTypeUDT>(
-        getSymIndexId());
-  }
-
   void dump(PDBSymDumper &Dumper) const override;
 
   FORWARD_SYMBOL_ID_METHOD(getClassParent)
index 7eabed8..5c095ea 100644 (file)
@@ -65,11 +65,3 @@ bool DIADataStream::getNext(RecordType &Record) {
 }
 
 void DIADataStream::reset() { StreamData->Reset(); }
-
-DIADataStream *DIADataStream::clone() const {
-  CComPtr<IDiaEnumDebugStreamData> EnumeratorClone;
-  if (S_OK != StreamData->Clone(&EnumeratorClone))
-    return nullptr;
-
-  return new DIADataStream(EnumeratorClone);
-}
index f62c499..d2451f1 100644 (file)
@@ -45,10 +45,3 @@ std::unique_ptr<IPDBDataStream> DIAEnumDebugStreams::getNext() {
 }
 
 void DIAEnumDebugStreams::reset() { Enumerator->Reset(); }
-
-DIAEnumDebugStreams *DIAEnumDebugStreams::clone() const {
-  CComPtr<IDiaEnumDebugStreams> EnumeratorClone;
-  if (S_OK != Enumerator->Clone(&EnumeratorClone))
-    return nullptr;
-  return new DIAEnumDebugStreams(EnumeratorClone);
-}
index d7c908e..f90de34 100644 (file)
@@ -43,10 +43,3 @@ std::unique_ptr<IPDBInjectedSource> DIAEnumInjectedSources::getNext() {
 }
 
 void DIAEnumInjectedSources::reset() { Enumerator->Reset(); }
-
-DIAEnumInjectedSources *DIAEnumInjectedSources::clone() const {
-  CComPtr<IDiaEnumInjectedSources> EnumeratorClone;
-  if (S_OK != Enumerator->Clone(&EnumeratorClone))
-    return nullptr;
-  return new DIAEnumInjectedSources(Session, EnumeratorClone);
-}
index 796ce21..0820d9d 100644 (file)
@@ -42,10 +42,3 @@ std::unique_ptr<IPDBLineNumber> DIAEnumLineNumbers::getNext() {
 }
 
 void DIAEnumLineNumbers::reset() { Enumerator->Reset(); }
-
-DIAEnumLineNumbers *DIAEnumLineNumbers::clone() const {
-  CComPtr<IDiaEnumLineNumbers> EnumeratorClone;
-  if (S_OK != Enumerator->Clone(&EnumeratorClone))
-    return nullptr;
-  return new DIAEnumLineNumbers(EnumeratorClone);
-}
index 1f405f0..90c857a 100644 (file)
@@ -45,10 +45,3 @@ std::unique_ptr<IPDBSectionContrib> DIAEnumSectionContribs::getNext() {
 }
 
 void DIAEnumSectionContribs::reset() { Enumerator->Reset(); }
-
-DIAEnumSectionContribs *DIAEnumSectionContribs::clone() const {
-  CComPtr<IDiaEnumSectionContribs> EnumeratorClone;
-  if (S_OK != Enumerator->Clone(&EnumeratorClone))
-    return nullptr;
-  return new DIAEnumSectionContribs(Session, EnumeratorClone);
-}
index b9311d0..06595e7 100644 (file)
@@ -42,10 +42,3 @@ std::unique_ptr<IPDBSourceFile> DIAEnumSourceFiles::getNext() {
 }
 
 void DIAEnumSourceFiles::reset() { Enumerator->Reset(); }
-
-DIAEnumSourceFiles *DIAEnumSourceFiles::clone() const {
-  CComPtr<IDiaEnumSourceFiles> EnumeratorClone;
-  if (S_OK != Enumerator->Clone(&EnumeratorClone))
-    return nullptr;
-  return new DIAEnumSourceFiles(Session, EnumeratorClone);
-}
index 2666385..48bc327 100644 (file)
@@ -46,10 +46,3 @@ std::unique_ptr<PDBSymbol> DIAEnumSymbols::getNext() {
 }
 
 void DIAEnumSymbols::reset() { Enumerator->Reset(); }
-
-DIAEnumSymbols *DIAEnumSymbols::clone() const {
-  CComPtr<IDiaEnumSymbols> EnumeratorClone;
-  if (S_OK != Enumerator->Clone(&EnumeratorClone))
-    return nullptr;
-  return new DIAEnumSymbols(Session, EnumeratorClone);
-}
index 511b555..f0f0241 100644 (file)
@@ -44,10 +44,3 @@ std::unique_ptr<IPDBTable> DIAEnumTables::getNext() {
 }
 
 void DIAEnumTables::reset() { Enumerator->Reset(); }
-
-DIAEnumTables *DIAEnumTables::clone() const {
-  CComPtr<IDiaEnumTables> EnumeratorClone;
-  if (S_OK != Enumerator->Clone(&EnumeratorClone))
-    return nullptr;
-  return new DIAEnumTables(EnumeratorClone);
-}
index b278526..64ddf75 100644 (file)
@@ -33,10 +33,6 @@ void NativeCompilandSymbol::dump(raw_ostream &OS, int Indent) const {
                   Indent);
 }
 
-std::unique_ptr<NativeRawSymbol> NativeCompilandSymbol::clone() const {
-  return llvm::make_unique<NativeCompilandSymbol>(Session, SymbolId, Module);
-}
-
 bool NativeCompilandSymbol::isEditAndContinueEnabled() const {
   return Module.hasECInfo();
 }
index 9dd66f3..6e4d564 100644 (file)
@@ -40,9 +40,5 @@ std::unique_ptr<PDBSymbol> NativeEnumModules::getNext() {
 
 void NativeEnumModules::reset() { Index = 0; }
 
-NativeEnumModules *NativeEnumModules::clone() const {
-  return new NativeEnumModules(Session, Index);
-}
-
 }
 }
index 2242106..c621e59 100644 (file)
@@ -54,9 +54,5 @@ std::unique_ptr<PDBSymbol> NativeEnumTypes::getNext() {
 
 void NativeEnumTypes::reset() { Index = 0; }
 
-NativeEnumTypes *NativeEnumTypes::clone() const {
-  return new NativeEnumTypes(Session, Matches, Kind);
-}
-
 } // namespace pdb
 } // namespace llvm
index 1fbdc2b..97d20d4 100644 (file)
@@ -34,10 +34,6 @@ NativeExeSymbol::NativeExeSymbol(NativeSession &Session, SymIndexId SymbolId)
     : NativeRawSymbol(Session, PDB_SymType::Exe, SymbolId),
       Dbi(getDbiStreamPtr(Session)) {}
 
-std::unique_ptr<NativeRawSymbol> NativeExeSymbol::clone() const {
-  return llvm::make_unique<NativeExeSymbol>(Session, SymbolId);
-}
-
 std::unique_ptr<IPDBEnumSymbols>
 NativeExeSymbol::findChildren(PDB_SymType Type) const {
   switch (Type) {
index 5a8400a..6031bba 100644 (file)
@@ -20,10 +20,6 @@ NativeTypeBuiltin::NativeTypeBuiltin(NativeSession &PDBSession, SymIndexId Id,
 
 NativeTypeBuiltin::~NativeTypeBuiltin() {}
 
-std::unique_ptr<NativeRawSymbol> NativeTypeBuiltin::clone() const {
-  return llvm::make_unique<NativeTypeBuiltin>(Session, SymbolId, Type, Length);
-}
-
 void NativeTypeBuiltin::dump(raw_ostream &OS, int Indent) const {
 }
 
index ddb874b..6c1d4cc 100644 (file)
@@ -59,10 +59,6 @@ void NativeTypeEnum::dump(raw_ostream &OS, int Indent) const {
   dumpSymbolField(OS, "volatileType", isVolatileType(), Indent);
 }
 
-std::unique_ptr<NativeRawSymbol> NativeTypeEnum::clone() const {
-  return llvm::make_unique<NativeTypeEnum>(Session, SymbolId, CV);
-}
-
 std::unique_ptr<IPDBEnumSymbols>
 NativeTypeEnum::findChildren(PDB_SymType Type) const {
   switch (Type) {
index 0a648c7..3e5140c 100644 (file)
@@ -49,10 +49,6 @@ void NativeTypePointer::dump(raw_ostream &OS, int Indent) const {
   dumpSymbolField(OS, "volatileType", isVolatileType(), Indent);
 }
 
-std::unique_ptr<NativeRawSymbol> NativeTypePointer::clone() const {
-  return llvm::make_unique<NativeTypePointer>(Session, SymbolId, Record);
-}
-
 bool NativeTypePointer::isConstType() const { return false; }
 
 uint64_t NativeTypePointer::getLength() const { return Record.getSize(); }
index ca39a76..22ce972 100644 (file)
@@ -135,10 +135,6 @@ void PDBSymbol::dumpChildStats() const {
   outs().flush();
 }
 
-std::unique_ptr<PDBSymbol> PDBSymbol::clone() const {
-  return Session.getSymbolById(getSymIndexId());
-}
-
 PDB_SymType PDBSymbol::getSymTag() const { return RawSymbol->getSymTag(); }
 uint32_t PDBSymbol::getSymIndexId() const { return RawSymbol->getSymIndexId(); }
 
index c810e4e..75063cb 100644 (file)
@@ -69,10 +69,6 @@ public:
 
   void reset() override { CurIter = Args.empty() ? Args.end() : Args.begin(); }
 
-  FunctionArgEnumerator *clone() const override {
-    return new FunctionArgEnumerator(Session, Func);
-  }
-
 private:
   typedef std::vector<std::unique_ptr<PDBSymbolData>> ArgListType;
   const IPDBSession &Session;
index c6148a3..c0564d3 100644 (file)
@@ -56,11 +56,6 @@ public:
 
   void reset() override { Enumerator->reset(); }
 
-  MyType *clone() const override {
-    std::unique_ptr<ArgEnumeratorType> Clone(Enumerator->clone());
-    return new FunctionArgEnumerator(Session, std::move(Clone));
-  }
-
 private:
   const IPDBSession &Session;
   std::unique_ptr<ArgEnumeratorType> Enumerator;