[clang] 0d0a99c - [msan] Advance before destroying entry

Vitaly Buka via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 19 16:57:51 PDT 2022


Author: Vitaly Buka
Date: 2022-04-19T16:42:04-07:00
New Revision: 0d0a99cb96183027af8212d0b8545356b65be0d3

URL: https://github.com/llvm/llvm-project/commit/0d0a99cb96183027af8212d0b8545356b65be0d3
DIFF: https://github.com/llvm/llvm-project/commit/0d0a99cb96183027af8212d0b8545356b65be0d3.diff

LOG: [msan] Advance before destroying entry

-fsanitize-memory-use-after-dtor reports this memory access.

Added: 
    

Modified: 
    clang/lib/Analysis/PathDiagnostic.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp
index ee8185c2147c0..90c4624018069 100644
--- a/clang/lib/Analysis/PathDiagnostic.cpp
+++ b/clang/lib/Analysis/PathDiagnostic.cpp
@@ -434,8 +434,8 @@ void PathDiagnosticConsumer::FlushDiagnostics(
 }
 
 PathDiagnosticConsumer::FilesMade::~FilesMade() {
-  for (PDFileEntry &Entry : Set)
-    Entry.~PDFileEntry();
+  for (auto It = Set.begin(); It != Set.end();)
+    (It++)->~PDFileEntry();
 }
 
 void PathDiagnosticConsumer::FilesMade::addDiagnostic(const PathDiagnostic &PD,


        


More information about the cfe-commits mailing list