[analyzer] Fix disappearing notes in DanglingInternalBufferChecker tests
Correct a mistake of the exact same kind I am writing this checker for.
llvm-svn: 337466
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index 9049fa3..5dcd9b3 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -2901,6 +2901,9 @@
// 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 @@
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";