diff options
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp b/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp index 2e442c7..2ba7ea4 100644 --- a/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp @@ -160,10 +160,8 @@ void DereferenceChecker::reportBug(ProgramStateRef State, const Stmt *S, } os.flush(); - BugReport *report = - new BugReport(*BT_null, - buf.empty() ? BT_null->getDescription() : StringRef(buf), - N); + auto report = llvm::make_unique<BugReport>( + *BT_null, buf.empty() ? BT_null->getDescription() : StringRef(buf), N); bugreporter::trackNullOrUndefValue(N, bugreporter::getDerefExpr(S), *report); @@ -171,7 +169,7 @@ void DereferenceChecker::reportBug(ProgramStateRef State, const Stmt *S, I = Ranges.begin(), E = Ranges.end(); I!=E; ++I) report->addRange(*I); - C.emitReport(report); + C.emitReport(std::move(report)); } void DereferenceChecker::checkLocation(SVal l, bool isLoad, const Stmt* S, @@ -183,11 +181,11 @@ void DereferenceChecker::checkLocation(SVal l, bool isLoad, const Stmt* S, BT_undef.reset( new BuiltinBug(this, "Dereference of undefined pointer value")); - BugReport *report = - new BugReport(*BT_undef, BT_undef->getDescription(), N); + auto report = + llvm::make_unique<BugReport>(*BT_undef, BT_undef->getDescription(), N); bugreporter::trackNullOrUndefValue(N, bugreporter::getDerefExpr(S), *report); - C.emitReport(report); + C.emitReport(std::move(report)); } return; } |