[cfe-commits] r155849 - in /cfe/trunk: include/clang/AST/RecursiveASTVisitor.h test/Index/index-many-call-ops.cpp

Argyrios Kyrtzidis kyrtzidis at apple.com
Mon Apr 30 17:31:42 PDT 2012


On Apr 30, 2012, at 5:21 PM, Richard Smith wrote:

> Hi,
> 
> 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.
> 
> I suppose this could be fixed by checking &RecursiveASTVisitor::TraverseCXXOperatorCallExpr == &Derived::TraverseCXXOperatorCallExpr before choosing data recursion, but perhaps there's a better way.

Thanks for letting me know, I'll see if I can come up with a better approach. In the meantime feel free to revert the commit if it is blocking you.

-Argyrios

> 
> On Mon, Apr 30, 2012 at 3:12 PM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
> Author: akirtzidis
> Date: Mon Apr 30 17:12:26 2012
> New Revision: 155849
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=155849&view=rev
> Log:
> For RecursiveASTVisitor, do data recursion for CXXOperatorCallExpr.
> 
> rdar://11289247
> 
> Added:
>    cfe/trunk/test/Index/index-many-call-ops.cpp
> Modified:
>    cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
> 
> Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=155849&r1=155848&r2=155849&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
> +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Mon Apr 30 17:12:26 2012
> @@ -151,7 +151,8 @@
>   /// \brief Return whether \param S should be traversed using data recursion
>   /// to avoid a stack overflow with extreme cases.
>   bool shouldUseDataRecursionFor(Stmt *S) const {
> -    return isa<BinaryOperator>(S) || isa<UnaryOperator>(S) || isa<CaseStmt>(S);
> +    return isa<BinaryOperator>(S) || isa<UnaryOperator>(S) ||
> +           isa<CaseStmt>(S) || isa<CXXOperatorCallExpr>(S);
>   }
> 
>   /// \brief Recursively visit a statement or expression, by
> 
> Added: cfe/trunk/test/Index/index-many-call-ops.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/index-many-call-ops.cpp?rev=155849&view=auto
> ==============================================================================
> --- cfe/trunk/test/Index/index-many-call-ops.cpp (added)
> +++ cfe/trunk/test/Index/index-many-call-ops.cpp Mon Apr 30 17:12:26 2012
> @@ -0,0 +1,47 @@
> +// RUN: c-index-test -index-file %s | FileCheck %s
> +
> +// rdar://11289247
> +// Check that we don't get stack overflow trying to index a huge number of
> +// call operators.
> +
> +struct S {
> +  S &operator()();
> +};
> +
> +// CHECK: [indexDeclaration]: kind: function | name: foo
> +void foo() {
> +  S s;
> +  s()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +   ()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()
> +    ;
> +}
> +
> +// CHECK: [indexDeclaration]: kind: function | name: bar
> +void bar();
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120430/24d01cf2/attachment.html>


More information about the cfe-commits mailing list