summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2015-06-23 13:15:32 +0000
committerAaron Ballman <aaron@aaronballman.com>2015-06-23 13:15:32 +0000
commit8d3a7a56a944f6b8452cb8e21ba68a293c7f5202 (patch)
treee7f2906cae208f6db629b25f46559dddb46ff5a1 /clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp
parent91d35a5e225c592a885ca993ce5628228ff26a49 (diff)
downloadbcm5719-llvm-8d3a7a56a944f6b8452cb8e21ba68a293c7f5202.tar.gz
bcm5719-llvm-8d3a7a56a944f6b8452cb8e21ba68a293c7f5202.zip
Clarify pointer ownership semantics by hoisting the std::unique_ptr creation to the caller instead of hiding it in emitReport. NFC.
llvm-svn: 240400
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp
index 083075db8fb..638701da8a0 100644
--- a/clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp
@@ -171,14 +171,14 @@ void TestAfterDivZeroChecker::reportBug(SVal Val, CheckerContext &C) const {
if (!DivZeroBug)
DivZeroBug.reset(new BuiltinBug(this, "Division by zero"));
- BugReport *R =
- new BugReport(*DivZeroBug, "Value being compared against zero has "
- "already been used for division",
- N);
+ auto R = llvm::make_unique<BugReport>(
+ *DivZeroBug, "Value being compared against zero has already been used "
+ "for division",
+ N);
R->addVisitor(llvm::make_unique<DivisionBRVisitor>(Val.getAsSymbol(),
C.getStackFrame()));
- C.emitReport(R);
+ C.emitReport(std::move(R));
}
}
OpenPOWER on IntegriCloud