diff options
Diffstat (limited to 'contrib/llvm/lib/CodeGen/GCMetadata.cpp')
| -rw-r--r-- | contrib/llvm/lib/CodeGen/GCMetadata.cpp | 29 | 
1 files changed, 11 insertions, 18 deletions
diff --git a/contrib/llvm/lib/CodeGen/GCMetadata.cpp b/contrib/llvm/lib/CodeGen/GCMetadata.cpp index ef5247c2edff..c3e4f3ee2fb1 100644 --- a/contrib/llvm/lib/CodeGen/GCMetadata.cpp +++ b/contrib/llvm/lib/CodeGen/GCMetadata.cpp @@ -32,12 +32,12 @@ namespace {    public:      explicit Printer(raw_ostream &OS) : FunctionPass(ID), OS(OS) {} -     -    const char *getPassName() const; -    void getAnalysisUsage(AnalysisUsage &AU) const; -     -    bool runOnFunction(Function &F); -    bool doFinalization(Module &M); + +    const char *getPassName() const override; +    void getAnalysisUsage(AnalysisUsage &AU) const override; + +    bool runOnFunction(Function &F) override; +    bool doFinalization(Module &M) override;    };  } @@ -61,10 +61,6 @@ GCModuleInfo::GCModuleInfo()    initializeGCModuleInfoPass(*PassRegistry::getPassRegistry());  } -GCModuleInfo::~GCModuleInfo() { -  clear(); -} -  GCStrategy *GCModuleInfo::getOrCreateStrategy(const Module *M,                                                const std::string &Name) {    strategy_map_type::iterator NMI = StrategyMap.find(Name); @@ -74,17 +70,17 @@ GCStrategy *GCModuleInfo::getOrCreateStrategy(const Module *M,    for (GCRegistry::iterator I = GCRegistry::begin(),                              E = GCRegistry::end(); I != E; ++I) {      if (Name == I->getName()) { -      GCStrategy *S = I->instantiate(); +      std::unique_ptr<GCStrategy> S = I->instantiate();        S->M = M;        S->Name = Name; -      StrategyMap.GetOrCreateValue(Name).setValue(S); -      StrategyList.push_back(S); -      return S; +      StrategyMap.GetOrCreateValue(Name).setValue(S.get()); +      StrategyList.push_back(std::move(S)); +      return StrategyList.back().get();      }    }    dbgs() << "unsupported GC: " << Name << "\n"; -  llvm_unreachable(0); +  llvm_unreachable(nullptr);  }  GCFunctionInfo &GCModuleInfo::getFunctionInfo(const Function &F) { @@ -104,9 +100,6 @@ GCFunctionInfo &GCModuleInfo::getFunctionInfo(const Function &F) {  void GCModuleInfo::clear() {    FInfoMap.clear();    StrategyMap.clear(); -   -  for (iterator I = begin(), E = end(); I != E; ++I) -    delete *I;    StrategyList.clear();  }  | 
