Fixed a bug where the parser-specific members of
persistent variables were staying around too long.
This caused the following problem:

- A persistent result variable is created for the
  result of an expression.  The pointer to the
  corresponding Decl is stored in the variable.

- The persistent variable is looked up during
  struct generation (correctly) using its Decl.

- Another expression defines a new result variable
  which happens to have a Decl in the same place
  as the original result variable.

- The persistent variable is looked up during
  struct generation using its Decl, but the old
  result variable appears first in the list and
  has the same Decl pointer.

The fix is to destroy parser-specific data when
it is no longer valid.

Also improved some logging as I diagnosed the
bug.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@112540 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/IRForTarget.cpp b/source/Expression/IRForTarget.cpp
index d74302c..b76dd2c 100644
--- a/source/Expression/IRForTarget.cpp
+++ b/source/Expression/IRForTarget.cpp
@@ -529,6 +529,7 @@
         off_t value_alignment = m_target_data->getPrefTypeAlignment(value_type);
         
         if (named_decl && !m_decl_map->AddValueToStruct(named_decl,
+                                                        name.c_str(),
                                                         V,
                                                         value_size, 
                                                         value_alignment))
@@ -881,13 +882,15 @@
         const clang::NamedDecl *decl;
         Value *value;
         off_t offset;
+        const char *name;
         
-        if (!m_decl_map->GetStructElement (decl, value, offset, element_index))
+        if (!m_decl_map->GetStructElement (decl, value, offset, name, element_index))
             return false;
         
         if (log)
-            log->Printf("  %s (%s) placed at %d",
+            log->Printf("  %s [%s] (%s) placed at %d",
                         value->getName().str().c_str(),
+                        name,
                         PrintValue(value, true).c_str(),
                         offset);