[PATCH] Do not store duplicate parents when memoization data is available.

Samuel Benzaquen sbenza at google.com
Fri Jun 13 06:11:02 PDT 2014


================
Comment at: lib/AST/ASTContext.cpp:8183
@@ +8182,3 @@
+        // For example when we visit all subexpressions of template
+        // instantiations; this is suboptimal, bug benign: the only way to
+        // visit those is with hasAncestor / hasParent, and those do not create
----------------
Manuel Klimek wrote:
> Please fix my "bug benign" typo :D
Done.

================
Comment at: lib/AST/ASTContext.cpp:8209-8212
@@ +8208,6 @@
+              ParentMemo &&
+              std::any_of(Vector->begin(), Vector->end(),
+                          [=](const ast_type_traits::DynTypedNode &Node) {
+                return Node.getMemoizationData() == ParentMemo;
+              });
+          if (!Found)
----------------
Manuel Klimek wrote:
> Any reason not to use std::find?
I was afraid that operator== will break for non-memo types, but as long as one of the arguments has memo, then it gives a correct result. Changed.

http://reviews.llvm.org/D4124






More information about the cfe-commits mailing list