[PATCH] D12912: ScalarEvolution: added tmp to avoid use-after-dtor in for loop.

Naomi Musgrave via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 15:27:52 PDT 2015


nmusgrave updated this revision to Diff 34932.
nmusgrave marked an inline comment as done.
nmusgrave updated the summary for this revision.
nmusgrave added a comment.

- Rename temp var.


http://reviews.llvm.org/D12912

Files:
  lib/Analysis/ScalarEvolution.cpp

Index: lib/Analysis/ScalarEvolution.cpp
===================================================================
--- lib/Analysis/ScalarEvolution.cpp
+++ lib/Analysis/ScalarEvolution.cpp
@@ -8394,8 +8394,11 @@
 ScalarEvolution::~ScalarEvolution() {
   // Iterate through all the SCEVUnknown instances and call their
   // destructors, so that they release their references to their values.
-  for (SCEVUnknown *U = FirstUnknown; U; U = U->Next)
-    U->~SCEVUnknown();
+  for (SCEVUnknown *U = FirstUnknown; U;) {
+    SCEVUnknown *Tmp = U;
+    U = U->Next;
+    Tmp->~SCEVUnknown();
+  }
   FirstUnknown = nullptr;
 
   ValueExprMap.clear();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12912.34932.patch
Type: text/x-patch
Size: 639 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150916/d3246f63/attachment.bin>


More information about the llvm-commits mailing list