[PATCH] D52336: [analyzer] [NFC] Prefer make_unique over "new"
George Karpenkov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 21 13:40:30 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL342767: [analyzer] [NFC] Prefer make_unique over "new" (authored by george.karpenkov, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D52336?vs=166398&id=166549#toc
Repository:
rL LLVM
https://reviews.llvm.org/D52336
Files:
cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
Index: cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
===================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp
@@ -750,9 +750,8 @@
}
assert(BT);
- auto report = std::unique_ptr<BugReport>(
- new CFRefReport(*BT, C.getASTContext().getLangOpts(),
- SummaryLog, N, Sym));
+ auto report = llvm::make_unique<CFRefReport>(
+ *BT, C.getASTContext().getLangOpts(), SummaryLog, N, Sym);
report->addRange(ErrorRange);
C.emitReport(std::move(report));
}
@@ -951,9 +950,9 @@
ExplodedNode *N = C.addTransition(state, Pred, &ReturnOwnLeakTag);
if (N) {
const LangOptions &LOpts = C.getASTContext().getLangOpts();
- C.emitReport(std::unique_ptr<BugReport>(new CFRefLeakReport(
- *getLeakAtReturnBug(LOpts), LOpts,
- SummaryLog, N, Sym, C, IncludeAllocationLine)));
+ C.emitReport(llvm::make_unique<CFRefLeakReport>(
+ *getLeakAtReturnBug(LOpts), LOpts, SummaryLog, N, Sym, C,
+ IncludeAllocationLine));
}
}
}
@@ -978,9 +977,9 @@
if (!returnNotOwnedForOwned)
returnNotOwnedForOwned.reset(new ReturnedNotOwnedForOwned(this));
- C.emitReport(std::unique_ptr<BugReport>(new CFRefReport(
+ C.emitReport(llvm::make_unique<CFRefReport>(
*returnNotOwnedForOwned, C.getASTContext().getLangOpts(),
- SummaryLog, N, Sym)));
+ SummaryLog, N, Sym));
}
}
}
@@ -1182,9 +1181,8 @@
overAutorelease.reset(new OverAutorelease(this));
const LangOptions &LOpts = Ctx.getASTContext().getLangOpts();
- Ctx.emitReport(std::unique_ptr<BugReport>(
- new CFRefReport(*overAutorelease, LOpts,
- SummaryLog, N, Sym, os.str())));
+ Ctx.emitReport(llvm::make_unique<CFRefReport>(
+ *overAutorelease, LOpts, SummaryLog, N, Sym, os.str()));
}
return nullptr;
@@ -1235,9 +1233,8 @@
: getLeakAtReturnBug(LOpts);
assert(BT && "BugType not initialized.");
- Ctx.emitReport(std::unique_ptr<BugReport>(
- new CFRefLeakReport(*BT, LOpts, SummaryLog, N, *I, Ctx,
- IncludeAllocationLine)));
+ Ctx.emitReport(llvm::make_unique<CFRefLeakReport>(
+ *BT, LOpts, SummaryLog, N, *I, Ctx, IncludeAllocationLine));
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52336.166549.patch
Type: text/x-patch
Size: 2609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180921/d260cebe/attachment.bin>
More information about the llvm-commits
mailing list