From: Reka Kovacs Date: Thu, 19 Jul 2018 15:44:46 +0000 (+0000) Subject: [analyzer] Fix disappearing notes in DanglingInternalBufferChecker tests X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9934e6ea141eddb6a62383bd585555688539c394;p=clang [analyzer] Fix disappearing notes in DanglingInternalBufferChecker tests Correct a mistake of the exact same kind I am writing this checker for. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337466 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp index 9049fa324b..5dcd9b3863 100644 --- a/lib/StaticAnalyzer/Checkers/MallocChecker.cpp +++ b/lib/StaticAnalyzer/Checkers/MallocChecker.cpp @@ -2901,6 +2901,9 @@ std::shared_ptr MallocChecker::MallocBugVisitor::VisitNode( // Find out if this is an interesting point and what is the kind. const char *Msg = nullptr; StackHintGeneratorForSymbol *StackHint = nullptr; + SmallString<256> Buf; + llvm::raw_svector_ostream OS(Buf); + if (Mode == Normal) { if (isAllocated(RS, RSPrev, S)) { Msg = "Memory is allocated"; @@ -2917,8 +2920,6 @@ std::shared_ptr MallocChecker::MallocBugVisitor::VisitNode( Msg = "Memory is released"; break; case AF_InternalBuffer: { - SmallString<256> Buf; - llvm::raw_svector_ostream OS(Buf); OS << "Inner pointer invalidated by call to "; if (N->getLocation().getKind() == ProgramPoint::PostImplicitCallKind) { OS << "destructor";