From: Chris Lattner Date: Sun, 26 Aug 2007 22:08:29 +0000 (+0000) Subject: If a visitor doesn't define VisitBinMulAssign, fallback to VisitCompoundAssignOperator X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=61919a125a9422002588a7b59e9d1df70089ee17;p=clang If a visitor doesn't define VisitBinMulAssign, fallback to VisitCompoundAssignOperator instead of VisitBinaryOperator. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41462 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/StmtVisitor.h b/include/clang/AST/StmtVisitor.h index 38a38322f6..1c252965bd 100644 --- a/include/clang/AST/StmtVisitor.h +++ b/include/clang/AST/StmtVisitor.h @@ -129,13 +129,20 @@ public: BINOP_FALLBACK(LAnd) BINOP_FALLBACK(LOr) BINOP_FALLBACK(Assign) - BINOP_FALLBACK(MulAssign) BINOP_FALLBACK(DivAssign) BINOP_FALLBACK(RemAssign) - BINOP_FALLBACK(AddAssign) BINOP_FALLBACK(SubAssign) BINOP_FALLBACK(ShlAssign) - BINOP_FALLBACK(ShrAssign) BINOP_FALLBACK(AndAssign) BINOP_FALLBACK(OrAssign) - BINOP_FALLBACK(XorAssign) - BINOP_FALLBACK(Comma) #undef BINOP_FALLBACK + + // If the implementation doesn't implement compound assignment operator + // methods, fall back on VisitCompoundAssignOperator. +#define CAO_FALLBACK(NAME) \ + RetTy VisitBin ## NAME(CompoundAssignOperator *S) { \ + DISPATCH(CompoundAssignOperator, CompoundAssignOperator); \ + } + CAO_FALLBACK(MulAssign) CAO_FALLBACK(DivAssign) CAO_FALLBACK(RemAssign) + CAO_FALLBACK(AddAssign) CAO_FALLBACK(SubAssign) CAO_FALLBACK(ShlAssign) + CAO_FALLBACK(ShrAssign) CAO_FALLBACK(AndAssign) CAO_FALLBACK(OrAssign) + CAO_FALLBACK(XorAssign) +#undef CAO_FALLBACK // If the implementation doesn't implement unary operator methods, fall back // on VisitUnaryOperator.