<div class="gmail_extra">Hi,</div><div class="gmail_extra"><br></div><div class="gmail_extra">With this change, TraverseCXXOperatorCallExpr is no longer called -- dataTraverse just calls the WalkFoo() functions for a Foo node, and misses the TraverseFoo function. This breaks include-what-you-use. Looking through the code, I'm also concerned that dataTraverse skips over ParenExprs, violating the requirement that RecursiveASTVisitor visit each node exactly once.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">I suppose this could be fixed by checking &RecursiveASTVisitor::TraverseCXXOperatorCallExpr == &Derived::TraverseCXXOperatorCallExpr before choosing data recursion, but perhaps there's a better way.</div>
<div class="gmail_extra"><br></div><div class="gmail_extra">On Mon, Apr 30, 2012 at 3:12 PM, Argyrios Kyrtzidis <span dir="ltr"><<a href="mailto:akyrtzi@gmail.com" target="_blank">akyrtzi@gmail.com</a>></span> wrote:</div>
<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: akirtzidis<br>
Date: Mon Apr 30 17:12:26 2012<br>
New Revision: 155849<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=155849&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=155849&view=rev</a><br>
Log:<br>
For RecursiveASTVisitor, do data recursion for CXXOperatorCallExpr.<br>
<br>
rdar://11289247<br>
<br>
Added:<br>
cfe/trunk/test/Index/index-many-call-ops.cpp<br>
Modified:<br>
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h<br>
<br>
Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=155849&r1=155848&r2=155849&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=155849&r1=155848&r2=155849&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)<br>
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Mon Apr 30 17:12:26 2012<br>
@@ -151,7 +151,8 @@<br>
/// \brief Return whether \param S should be traversed using data recursion<br>
/// to avoid a stack overflow with extreme cases.<br>
bool shouldUseDataRecursionFor(Stmt *S) const {<br>
- return isa<BinaryOperator>(S) || isa<UnaryOperator>(S) || isa<CaseStmt>(S);<br>
+ return isa<BinaryOperator>(S) || isa<UnaryOperator>(S) ||<br>
+ isa<CaseStmt>(S) || isa<CXXOperatorCallExpr>(S);<br>
}<br>
<br>
/// \brief Recursively visit a statement or expression, by<br>
<br>
Added: cfe/trunk/test/Index/index-many-call-ops.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/index-many-call-ops.cpp?rev=155849&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/index-many-call-ops.cpp?rev=155849&view=auto</a><br>
==============================================================================<br>
--- cfe/trunk/test/Index/index-many-call-ops.cpp (added)<br>
+++ cfe/trunk/test/Index/index-many-call-ops.cpp Mon Apr 30 17:12:26 2012<br>
@@ -0,0 +1,47 @@<br>
+// RUN: c-index-test -index-file %s | FileCheck %s<br>
+<br>
+// rdar://11289247<br>
+// Check that we don't get stack overflow trying to index a huge number of<br>
+// call operators.<br>
+<br>
+struct S {<br>
+ S &operator()();<br>
+};<br>
+<br>
+// CHECK: [indexDeclaration]: kind: function | name: foo<br>
+void foo() {<br>
+ S s;<br>
+ s()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()<br>
+ ;<br>
+}<br>
+<br>
+// CHECK: [indexDeclaration]: kind: function | name: bar<br>
+void bar();<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>