[cfe-commits] Typo in RecursiveASTVisitor.h?

Benoit Perrot benoit at lrde.epita.fr
Tue Dec 7 01:33:17 PST 2010


Hello,

When playing with (inheriting from) "RecursiveASTVisitor", I observed
that "::TraverseBinAssign" (and other traversers of binary operators)
were never called. Except "::TraverseBinPtrMemD".

My investigations led me to the implementation of
"RecursiveASTVisitor<Derived>::TraverseStmt" (line 386 of
RecursiveASTVisitor.h), which says (line 393):

        if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(S)) {
          switch (BinOp->getOpcode()) {
      #define OPERATOR(NAME) \
          case BO_##NAME: DISPATCH(Bin##PtrMemD, BinaryOperator, S);

(See how every case of the switch actually dispatch to BinPtrMemD only)

Shouldn't it be the following:

      #define OPERATOR(NAME) \
          case BO_##NAME: DISPATCH(Bin##NAME, BinaryOperator, S);

?


Regards,
-- 
Benoit PERROT


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

-------------- next part --------------
(TraverseStmt) Effectively dispatch binary operators to specialized Traversers.

--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Tue Dec  7 09:56:06 2010
@@ -393,7 +393,7 @@
   if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(S)) {
     switch (BinOp->getOpcode()) {
 #define OPERATOR(NAME) \
-    case BO_##NAME: DISPATCH(Bin##PtrMemD, BinaryOperator, S);
+    case BO_##NAME: DISPATCH(Bin##NAME, BinaryOperator, S);
 
     BINOP_LIST()
 #undef OPERATOR


More information about the cfe-commits mailing list