rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

I think this can be cleaned up a bit further, but I'm fine with that happening 
after the patch lands. Thanks!



================
Comment at: lib/AST/ExprConstant.cpp:455-456
     // values are stable.
-    typedef std::map<const void*, APValue> MapTy;
-    typedef MapTy::const_iterator temp_iterator;
+    typedef std::map<unsigned, APValue> VersionToValueMap;
+    typedef std::map<const void *, VersionToValueMap> MapTy;
     /// Temporaries - Temporary lvalues materialized within this stack frame.
----------------
Have you considered using a pair<const void*, unsigned> as the key rather than 
a map-of-maps? It'd be preferable to only allocate one heap node rather than 
two for the (hopefully common) case where there is only one version of an 
object.


================
Comment at: lib/AST/ExprConstant.cpp:466
 
+    /// The stack of integers for tracking version numbers for temporaries.
+    SmallVector<unsigned, 2> TempVersionStack = {1};
----------------
If we're using this for variables in loops too, we should generalize the name 
and the description to not talk about temporaries.


https://reviews.llvm.org/D42776



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D42776: [... Akira Hatanaka via Phabricator via cfe-commits
    • [PATCH] D427... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D427... Akira Hatanaka via Phabricator via cfe-commits
    • [PATCH] D427... Akira Hatanaka via Phabricator via cfe-commits

Reply via email to