From: George Karpenkov Date: Fri, 21 Sep 2018 20:36:21 +0000 (+0000) Subject: [analyzer] [NFC] Prefer make_unique over "new" X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e914facd4258b84687db77b60e8b848204987b4;p=clang [analyzer] [NFC] Prefer make_unique over "new" Differential Revision: https://reviews.llvm.org/D52336 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342767 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp b/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp index 351816ae20..de113bbd05 100644 --- a/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp @@ -750,9 +750,8 @@ void RetainCountChecker::processNonLeakError(ProgramStateRef St, } assert(BT); - auto report = std::unique_ptr( - new CFRefReport(*BT, C.getASTContext().getLangOpts(), - SummaryLog, N, Sym)); + auto report = llvm::make_unique( + *BT, C.getASTContext().getLangOpts(), SummaryLog, N, Sym); report->addRange(ErrorRange); C.emitReport(std::move(report)); } @@ -951,9 +950,9 @@ void RetainCountChecker::checkReturnWithRetEffect(const ReturnStmt *S, ExplodedNode *N = C.addTransition(state, Pred, &ReturnOwnLeakTag); if (N) { const LangOptions &LOpts = C.getASTContext().getLangOpts(); - C.emitReport(std::unique_ptr(new CFRefLeakReport( - *getLeakAtReturnBug(LOpts), LOpts, - SummaryLog, N, Sym, C, IncludeAllocationLine))); + C.emitReport(llvm::make_unique( + *getLeakAtReturnBug(LOpts), LOpts, SummaryLog, N, Sym, C, + IncludeAllocationLine)); } } } @@ -978,9 +977,9 @@ void RetainCountChecker::checkReturnWithRetEffect(const ReturnStmt *S, if (!returnNotOwnedForOwned) returnNotOwnedForOwned.reset(new ReturnedNotOwnedForOwned(this)); - C.emitReport(std::unique_ptr(new CFRefReport( + C.emitReport(llvm::make_unique( *returnNotOwnedForOwned, C.getASTContext().getLangOpts(), - SummaryLog, N, Sym))); + SummaryLog, N, Sym)); } } } @@ -1182,9 +1181,8 @@ RetainCountChecker::handleAutoreleaseCounts(ProgramStateRef state, overAutorelease.reset(new OverAutorelease(this)); const LangOptions &LOpts = Ctx.getASTContext().getLangOpts(); - Ctx.emitReport(std::unique_ptr( - new CFRefReport(*overAutorelease, LOpts, - SummaryLog, N, Sym, os.str()))); + Ctx.emitReport(llvm::make_unique( + *overAutorelease, LOpts, SummaryLog, N, Sym, os.str())); } return nullptr; @@ -1235,9 +1233,8 @@ RetainCountChecker::processLeaks(ProgramStateRef state, : getLeakAtReturnBug(LOpts); assert(BT && "BugType not initialized."); - Ctx.emitReport(std::unique_ptr( - new CFRefLeakReport(*BT, LOpts, SummaryLog, N, *I, Ctx, - IncludeAllocationLine))); + Ctx.emitReport(llvm::make_unique( + *BT, LOpts, SummaryLog, N, *I, Ctx, IncludeAllocationLine)); } }