r337466 - [analyzer] Fix disappearing notes in DanglingInternalBufferChecker tests

Reka Kovacs via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 19 08:44:46 PDT 2018


Author: rkovacs
Date: Thu Jul 19 08:44:46 2018
New Revision: 337466

URL: http://llvm.org/viewvc/llvm-project?rev=337466&view=rev
Log:
[analyzer] Fix disappearing notes in DanglingInternalBufferChecker tests

Correct a mistake of the exact same kind I am writing this checker for.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp

Modified: cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp?rev=337466&r1=337465&r2=337466&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Checkers/MallocChecker.cpp Thu Jul 19 08:44:46 2018
@@ -2901,6 +2901,9 @@ std::shared_ptr<PathDiagnosticPiece> Mal
   // 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<PathDiagnosticPiece> Mal
           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";




More information about the cfe-commits mailing list