diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2018-01-18 00:10:21 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2018-01-18 00:10:21 +0000 |
commit | e769fb73b583441e68c322a1a7811561b0c58c60 (patch) | |
tree | cba1b055cca49cc5f28dfd716bfba07122fee914 /clang/lib | |
parent | 868e9a1144b3aeebb69955f2e07b5be76721b674 (diff) | |
download | bcm5719-llvm-e769fb73b583441e68c322a1a7811561b0c58c60.tar.gz bcm5719-llvm-e769fb73b583441e68c322a1a7811561b0c58c60.zip |
[analyzer] operator new: Fix path diagnostics around the operator call.
Implements finding appropriate source locations for intermediate diagnostic
pieces in path-sensitive bug reports that need to descend into an inlined
operator new() call that was called via new-expression. The diagnostics have
worked correctly when operator new() was called "directly".
Differential Revision: https://reviews.llvm.org/D41409
rdar://problem/12180598
llvm-svn: 322791
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp index fac0d380d47..b03517c02a8 100644 --- a/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp +++ b/clang/lib/StaticAnalyzer/Core/PathDiagnostic.cpp @@ -574,8 +574,11 @@ getLocationForCaller(const StackFrameContext *SFC, return PathDiagnosticLocation::createEnd(CallerBody, SM, CallerCtx); return PathDiagnosticLocation::create(CallerInfo->getDecl(), SM); } + case CFGElement::NewAllocator: { + const CFGNewAllocator &Alloc = Source.castAs<CFGNewAllocator>(); + return PathDiagnosticLocation(Alloc.getAllocatorExpr(), SM, CallerCtx); + } case CFGElement::TemporaryDtor: - case CFGElement::NewAllocator: llvm_unreachable("not yet implemented!"); case CFGElement::LifetimeEnds: case CFGElement::LoopExit: |