Commit 46ed9331 authored by David Blaikie's avatar David Blaikie
Browse files

[IR] Remove some unnecessary cleanup in Module's dtor, and use a unique_ptr to simplify some

Follow on from D72812, based on Mehdi Amini's feedback.
parent ff171acf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -177,7 +177,7 @@ private:
  IFuncListType IFuncList;        ///< The IFuncs in the module
  NamedMDListType NamedMDList;    ///< The named metadata in the module
  std::string GlobalScopeAsm;     ///< Inline Asm at global scope.
  ValueSymbolTable *ValSymTab;    ///< Symbol table for values
  std::unique_ptr<ValueSymbolTable> ValSymTab; ///< Symbol table for values
  ComdatSymTabType ComdatSymTab;  ///< Symbol table for COMDATs
  std::unique_ptr<MemoryBuffer>
  OwnedMemoryBuffer;              ///< Memory buffer directly owned by this
+2 −5
Original line number Diff line number Diff line
@@ -71,8 +71,8 @@ template class llvm::SymbolTableListTraits<GlobalIFunc>;
//

Module::Module(StringRef MID, LLVMContext &C)
    : Context(C), Materializer(), ModuleID(MID), SourceFileName(MID), DL("") {
  ValSymTab = new ValueSymbolTable();
    : Context(C), ValSymTab(std::make_unique<ValueSymbolTable>()),
      Materializer(), ModuleID(MID), SourceFileName(MID), DL("") {
  Context.addModule(this);
}

@@ -83,9 +83,6 @@ Module::~Module() {
  FunctionList.clear();
  AliasList.clear();
  IFuncList.clear();
  NamedMDList.clear();
  NamedMDSymTab.clear();
  delete ValSymTab;
}

std::unique_ptr<RandomNumberGenerator> Module::createRNG(const Pass* P) const {