r209092 - Format the two RecursiveASTVisitors
Sean Silva
chisophugis at gmail.com
Tue May 20 12:38:05 PDT 2014
On Tue, May 20, 2014 at 1:17 PM, Daniel Jasper <djasper at google.com> wrote:
> I personally don't care either way. Just wanted to shed some light on how
> clang-format does things and how it fails to understand the two columns of
> weird macro invocations with no structuring semicolons.
>
Do we have any documentation for these sorts of tricks?
-- Sean Silva
>
>
> On Tue, May 20, 2014 at 8:57 PM, Alp Toker <alp at nuanti.com> wrote:
>
>>
>> On 19/05/2014 10:15, Daniel Jasper wrote:
>>
>>>
>>>
>>>
>>> On Sun, May 18, 2014 at 8:38 PM, Alp Toker <alp at nuanti.com <mailto:
>>> alp at nuanti.com>> wrote:
>>>
>>> Author: alp
>>> Date: Sun May 18 13:38:19 2014
>>> New Revision: 209092
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=209092&view=rev
>>> Log:
>>> Format the two RecursiveASTVisitors
>>>
>>> Apply current ToT clang-format on the two RAVs to reduce delta and
>>> help
>>> identify differences between the two.
>>>
>>> We lose a little pretty formatting in the headers but that's the
>>> price to pay
>>> so we can diff these two files effectively and look to a future
>>> where we don't
>>> have to maintain two copies of this code.
>>>
>>> Formatting and whitespace only.
>>>
>>> Modified:
>>> cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
>>> cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
>>>
>>> Modified: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/
>>> DataRecursiveASTVisitor.h?rev=209092&r1=209091&r2=209092&view=diff
>>> ============================================================
>>> ==================
>>> --- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)
>>> +++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Sun May
>>> 18 13:38:19 2014
>>> @@ -38,34 +38,24 @@
>>> // using them is responsible for defining macro OPERATOR().
>>>
>>> // All unary operators.
>>> -#define UNARYOP_LIST() \
>>> - OPERATOR(PostInc) OPERATOR(PostDec) \
>>> - OPERATOR(PreInc) OPERATOR(PreDec) \
>>> - OPERATOR(AddrOf) OPERATOR(Deref) \
>>> - OPERATOR(Plus) OPERATOR(Minus) \
>>> - OPERATOR(Not) OPERATOR(LNot) \
>>> - OPERATOR(Real) OPERATOR(Imag) \
>>> - OPERATOR(Extension)
>>> +#define UNARYOP_LIST() \
>>> + OPERATOR(PostInc) OPERATOR(PostDec) OPERATOR(PreInc)
>>> OPERATOR(PreDec) \
>>> + OPERATOR(AddrOf) OPERATOR(Deref) OPERATOR(Plus)
>>> OPERATOR(Minus) \
>>> + OPERATOR(Not) OPERATOR(LNot) OPERATOR(Real) OPERATOR(Imag)
>>> \
>>> + OPERATOR(Extension)
>>>
>>>
>>> If you put them one per line, clang-format understands that these are
>>> macro invocations and leaves them one per line. Might be more readable.
>>>
>>
>> I've attached the patch putting them one per line but the jury's out on
>> whether it's a worthwhile improvement.
>>
>> What do you think? Give a nod and I'm fine to commit.
>>
>> (We can always tweak this or go back to hand-formatting if there's demand
>> once the files are unified.)
>>
>> Alp.
>>
>> // All binary operators (excluding compound assign operators).
>>> -#define BINOP_LIST() \
>>> - OPERATOR(PtrMemD) OPERATOR(PtrMemI) \
>>> - OPERATOR(Mul) OPERATOR(Div) OPERATOR(Rem) \
>>> - OPERATOR(Add) OPERATOR(Sub) OPERATOR(Shl) \
>>> - OPERATOR(Shr) \
>>> - \
>>> - OPERATOR(LT) OPERATOR(GT) OPERATOR(LE) \
>>> - OPERATOR(GE) OPERATOR(EQ) OPERATOR(NE) \
>>> - OPERATOR(And) OPERATOR(Xor) OPERATOR(Or) \
>>> - OPERATOR(LAnd) OPERATOR(LOr) \
>>> - \
>>> - OPERATOR(Assign) \
>>> - OPERATOR(Comma)
>>> +#define BINOP_LIST() \
>>> + OPERATOR(PtrMemD) OPERATOR(PtrMemI) OPERATOR(Mul) OPERATOR(Div)
>>> \
>>> + OPERATOR(Rem) OPERATOR(Add) OPERATOR(Sub) OPERATOR(Shl)
>>> OPERATOR(Shr) \
>>> + OPERATOR(LT) OPERATOR(GT) OPERATOR(LE) OPERATOR(GE)
>>> OPERATOR(EQ) \
>>> + OPERATOR(NE) OPERATOR(And) OPERATOR(Xor) OPERATOR(Or)
>>> OPERATOR(LAnd) \
>>> + OPERATOR(LOr) OPERATOR(Assign) OPERATOR(Comma)
>>>
>>> // All compound assign operators.
>>> -#define CAO_LIST() \
>>> - OPERATOR(Mul) OPERATOR(Div) OPERATOR(Rem) OPERATOR(Add)
>>> OPERATOR(Sub) \
>>> - OPERATOR(Shl) OPERATOR(Shr) OPERATOR(And) OPERATOR(Or)
>>> OPERATOR(Xor)
>>> +#define CAO_LIST() \
>>> + OPERATOR(Mul) OPERATOR(Div) OPERATOR(Rem) OPERATOR(Add)
>>> OPERATOR(Sub) \
>>> + OPERATOR(Shl) OPERATOR(Shr) OPERATOR(And) OPERATOR(Or)
>>> OPERATOR(Xor)
>>>
>>> namespace clang {
>>>
>>> @@ -77,8 +67,11 @@ namespace clang {
>>> // invokes CALL_EXPR, which must be a method call, on the derived
>>> // object (s.t. a user of RecursiveASTVisitor can override the
>>> method
>>> // in CALL_EXPR).
>>> -#define TRY_TO(CALL_EXPR) \
>>> - do { if (!getDerived().CALL_EXPR) return false; } while (0)
>>> +#define TRY_TO(CALL_EXPR) \
>>> + do { \
>>> + if (!getDerived().CALL_EXPR) \
>>> + return false; \
>>> + } while (0)
>>>
>>> /// \brief A class that does preorder depth-first traversal on the
>>> /// entire Clang AST and visits each node.
>>> @@ -144,11 +137,10 @@ namespace clang {
>>> /// to return true, in which case all known implicit and explicit
>>> /// instantiations will be visited at the same time as the pattern
>>> /// from which they were produced.
>>> -template<typename Derived>
>>> -class RecursiveASTVisitor {
>>> +template <typename Derived> class RecursiveASTVisitor {
>>> public:
>>> /// \brief Return a reference to the derived class.
>>> - Derived &getDerived() { return *static_cast<Derived*>(this); }
>>> + Derived &getDerived() { return *static_cast<Derived *>(this); }
>>>
>>> /// \brief Return whether this visitor should recurse into
>>> /// template instantiations.
>>> @@ -255,114 +247,111 @@ public:
>>> // \brief Visit an attribute.
>>> bool VisitAttr(Attr *A) { return true; }
>>>
>>> - // Declare Traverse* and empty Visit* for all Attr classes.
>>> +// Declare Traverse* and empty Visit* for all Attr classes.
>>> #define ATTR_VISITOR_DECLS_ONLY
>>> #include "clang/AST/AttrVisitor.inc"
>>> #undef ATTR_VISITOR_DECLS_ONLY
>>>
>>> - // ---- Methods on Stmts ----
>>> +// ---- Methods on Stmts ----
>>>
>>> - // Declare Traverse*() for all concrete Stmt classes.
>>> +// Declare Traverse*() for all concrete Stmt classes.
>>> #define ABSTRACT_STMT(STMT)
>>> -#define STMT(CLASS, PARENT) \
>>> - bool Traverse##CLASS(CLASS *S);
>>> +#define STMT(CLASS, PARENT) bool Traverse##CLASS(CLASS *S);
>>> #include "clang/AST/StmtNodes.inc"
>>> // The above header #undefs ABSTRACT_STMT and STMT upon exit.
>>>
>>> // Define WalkUpFrom*() and empty Visit*() for all Stmt classes.
>>> bool WalkUpFromStmt(Stmt *S) { return getDerived().VisitStmt(S); }
>>> bool VisitStmt(Stmt *S) { return true; }
>>> -#define STMT(CLASS, PARENT) \
>>> - bool WalkUpFrom##CLASS(CLASS *S) { \
>>> - TRY_TO(WalkUpFrom##PARENT(S)); \
>>> - TRY_TO(Visit##CLASS(S)); \
>>> - return true; \
>>> - } \
>>> +#define STMT(CLASS, PARENT) \
>>> + bool WalkUpFrom##CLASS(CLASS *S) { \
>>> + TRY_TO(WalkUpFrom##PARENT(S)); \
>>> + TRY_TO(Visit##CLASS(S)); \
>>> + return true; \
>>> + } \
>>> bool Visit##CLASS(CLASS *S) { return true; }
>>> #include "clang/AST/StmtNodes.inc"
>>>
>>> - // Define Traverse*(), WalkUpFrom*(), and Visit*() for unary
>>> - // operator methods. Unary operators are not classes in
>>> themselves
>>> - // (they're all opcodes in UnaryOperator) but do have visitors.
>>> -#define OPERATOR(NAME) \
>>> - bool TraverseUnary##NAME(UnaryOperator *S) { \
>>> - TRY_TO(WalkUpFromUnary##NAME(S)); \
>>> - StmtQueueAction StmtQueue(*this); \
>>> - StmtQueue.queue(S->getSubExpr()); \
>>> - return true; \
>>> - } \
>>> - bool WalkUpFromUnary##NAME(UnaryOperator *S) { \
>>> - TRY_TO(WalkUpFromUnaryOperator(S)); \
>>> - TRY_TO(VisitUnary##NAME(S)); \
>>> - return true; \
>>> - } \
>>> +// Define Traverse*(), WalkUpFrom*(), and Visit*() for unary
>>> +// operator methods. Unary operators are not classes in themselves
>>> +// (they're all opcodes in UnaryOperator) but do have visitors.
>>> +#define OPERATOR(NAME) \
>>> + bool TraverseUnary##NAME(UnaryOperator *S) {
>>> \
>>> + TRY_TO(WalkUpFromUnary##NAME(S)); \
>>> + StmtQueueAction StmtQueue(*this); \
>>> + StmtQueue.queue(S->getSubExpr()); \
>>> + return true; \
>>> + } \
>>> + bool WalkUpFromUnary##NAME(UnaryOperator *S) {
>>> \
>>> + TRY_TO(WalkUpFromUnaryOperator(S)); \
>>> + TRY_TO(VisitUnary##NAME(S)); \
>>> + return true; \
>>> + } \
>>> bool VisitUnary##NAME(UnaryOperator *S) { return true; }
>>>
>>> UNARYOP_LIST()
>>> #undef OPERATOR
>>>
>>> - // Define Traverse*(), WalkUpFrom*(), and Visit*() for binary
>>> - // operator methods. Binary operators are not classes in
>>> themselves
>>> - // (they're all opcodes in BinaryOperator) but do have visitors.
>>> -#define GENERAL_BINOP_FALLBACK(NAME, BINOP_TYPE) \
>>> - bool TraverseBin##NAME(BINOP_TYPE *S) { \
>>> - TRY_TO(WalkUpFromBin##NAME(S)); \
>>> - StmtQueueAction StmtQueue(*this); \
>>> - StmtQueue.queue(S->getLHS()); \
>>> - StmtQueue.queue(S->getRHS()); \
>>> - return true; \
>>> - } \
>>> - bool WalkUpFromBin##NAME(BINOP_TYPE *S) { \
>>> - TRY_TO(WalkUpFrom##BINOP_TYPE(S)); \
>>> - TRY_TO(VisitBin##NAME(S)); \
>>> - return true; \
>>> - } \
>>> +// Define Traverse*(), WalkUpFrom*(), and Visit*() for binary
>>> +// operator methods. Binary operators are not classes in themselves
>>> +// (they're all opcodes in BinaryOperator) but do have visitors.
>>> +#define GENERAL_BINOP_FALLBACK(NAME, BINOP_TYPE)
>>> \
>>> + bool TraverseBin##NAME(BINOP_TYPE *S) { \
>>> + TRY_TO(WalkUpFromBin##NAME(S)); \
>>> + StmtQueueAction StmtQueue(*this); \
>>> + StmtQueue.queue(S->getLHS()); \
>>> + StmtQueue.queue(S->getRHS()); \
>>> + return true; \
>>> + } \
>>> + bool WalkUpFromBin##NAME(BINOP_TYPE *S) { \
>>> + TRY_TO(WalkUpFrom##BINOP_TYPE(S)); \
>>> + TRY_TO(VisitBin##NAME(S)); \
>>> + return true; \
>>> + } \
>>> bool VisitBin##NAME(BINOP_TYPE *S) { return true; }
>>>
>>> #define OPERATOR(NAME) GENERAL_BINOP_FALLBACK(NAME, BinaryOperator)
>>> BINOP_LIST()
>>> #undef OPERATOR
>>>
>>> - // Define Traverse*(), WalkUpFrom*(), and Visit*() for compound
>>> - // assignment methods. Compound assignment operators are not
>>> - // classes in themselves (they're all opcodes in
>>> - // CompoundAssignOperator) but do have visitors.
>>> -#define OPERATOR(NAME) \
>>> +// Define Traverse*(), WalkUpFrom*(), and Visit*() for compound
>>> +// assignment methods. Compound assignment operators are not
>>> +// classes in themselves (they're all opcodes in
>>> +// CompoundAssignOperator) but do have visitors.
>>> +#define OPERATOR(NAME) \
>>> GENERAL_BINOP_FALLBACK(NAME##Assign, CompoundAssignOperator)
>>>
>>> CAO_LIST()
>>> #undef OPERATOR
>>> #undef GENERAL_BINOP_FALLBACK
>>>
>>> - // ---- Methods on Types ----
>>> - // FIXME: revamp to take TypeLoc's rather than Types.
>>> +// ---- Methods on Types ----
>>> +// FIXME: revamp to take TypeLoc's rather than Types.
>>>
>>> - // Declare Traverse*() for all concrete Type classes.
>>> +// Declare Traverse*() for all concrete Type classes.
>>> #define ABSTRACT_TYPE(CLASS, BASE)
>>> -#define TYPE(CLASS, BASE) \
>>> - bool Traverse##CLASS##Type(CLASS##Type *T);
>>> +#define TYPE(CLASS, BASE) bool Traverse##CLASS##Type(CLASS##Type
>>> *T);
>>> #include "clang/AST/TypeNodes.def"
>>> // The above header #undefs ABSTRACT_TYPE and TYPE upon exit.
>>>
>>> // Define WalkUpFrom*() and empty Visit*() for all Type classes.
>>> bool WalkUpFromType(Type *T) { return getDerived().VisitType(T); }
>>> bool VisitType(Type *T) { return true; }
>>> -#define TYPE(CLASS, BASE) \
>>> - bool WalkUpFrom##CLASS##Type(CLASS##Type *T) { \
>>> - TRY_TO(WalkUpFrom##BASE(T)); \
>>> - TRY_TO(Visit##CLASS##Type(T)); \
>>> - return true; \
>>> - } \
>>> +#define TYPE(CLASS, BASE) \
>>> + bool WalkUpFrom##CLASS##Type(CLASS##Type *T) {
>>> \
>>> + TRY_TO(WalkUpFrom##BASE(T)); \
>>> + TRY_TO(Visit##CLASS##Type(T)); \
>>> + return true; \
>>> + } \
>>> bool Visit##CLASS##Type(CLASS##Type *T) { return true; }
>>> #include "clang/AST/TypeNodes.def"
>>>
>>> - // ---- Methods on TypeLocs ----
>>> - // FIXME: this currently just calls the matching Type methods
>>> +// ---- Methods on TypeLocs ----
>>> +// FIXME: this currently just calls the matching Type methods
>>>
>>> - // Declare Traverse*() for all concrete Type classes.
>>> +// Declare Traverse*() for all concrete Type classes.
>>> #define ABSTRACT_TYPELOC(CLASS, BASE)
>>> -#define TYPELOC(CLASS, BASE) \
>>> - bool Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL);
>>> +#define TYPELOC(CLASS, BASE) bool
>>> Traverse##CLASS##TypeLoc(CLASS##TypeLoc TL);
>>> #include "clang/AST/TypeLocNodes.def"
>>> // The above header #undefs ABSTRACT_TYPELOC and TYPELOC upon
>>> exit.
>>>
>>> @@ -381,34 +370,33 @@ public:
>>> }
>>> bool VisitUnqualTypeLoc(UnqualTypeLoc TL) { return true; }
>>>
>>> - // Note that BASE includes trailing 'Type' which CLASS doesn't.
>>> -#define TYPE(CLASS, BASE) \
>>> - bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) { \
>>> - TRY_TO(WalkUpFrom##BASE##Loc(TL)); \
>>> - TRY_TO(Visit##CLASS##TypeLoc(TL)); \
>>> - return true; \
>>> - } \
>>> +// Note that BASE includes trailing 'Type' which CLASS doesn't.
>>> +#define TYPE(CLASS, BASE) \
>>> + bool WalkUpFrom##CLASS##TypeLoc(CLASS##TypeLoc TL) {
>>> \
>>> + TRY_TO(WalkUpFrom##BASE##Loc(TL)); \
>>> + TRY_TO(Visit##CLASS##TypeLoc(TL)); \
>>> + return true; \
>>> + } \
>>> bool Visit##CLASS##TypeLoc(CLASS##TypeLoc TL) { return true; }
>>> #include "clang/AST/TypeNodes.def"
>>>
>>> - // ---- Methods on Decls ----
>>> +// ---- Methods on Decls ----
>>>
>>> - // Declare Traverse*() for all concrete Decl classes.
>>> +// Declare Traverse*() for all concrete Decl classes.
>>> #define ABSTRACT_DECL(DECL)
>>> -#define DECL(CLASS, BASE) \
>>> - bool Traverse##CLASS##Decl(CLASS##Decl *D);
>>> +#define DECL(CLASS, BASE) bool Traverse##CLASS##Decl(CLASS##Decl
>>> *D);
>>> #include "clang/AST/DeclNodes.inc"
>>> // The above header #undefs ABSTRACT_DECL and DECL upon exit.
>>>
>>> // Define WalkUpFrom*() and empty Visit*() for all Decl classes.
>>> bool WalkUpFromDecl(Decl *D) { return getDerived().VisitDecl(D); }
>>> bool VisitDecl(Decl *D) { return true; }
>>> -#define DECL(CLASS, BASE) \
>>> - bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) { \
>>> - TRY_TO(WalkUpFrom##BASE(D)); \
>>> - TRY_TO(Visit##CLASS##Decl(D)); \
>>> - return true; \
>>> - } \
>>> +#define DECL(CLASS, BASE) \
>>> + bool WalkUpFrom##CLASS##Decl(CLASS##Decl *D) {
>>> \
>>> + TRY_TO(WalkUpFrom##BASE(D)); \
>>> + TRY_TO(Visit##CLASS##Decl(D)); \
>>> + return true; \
>>> + } \
>>> bool Visit##CLASS##Decl(CLASS##Decl *D) { return true; }
>>> #include "clang/AST/DeclNodes.inc"
>>>
>>> @@ -417,7 +405,7 @@ private:
>>> bool TraverseTemplateParameterListHelper(TemplateParameterList
>>> *TPL);
>>> bool TraverseClassInstantiations(ClassTemplateDecl *D);
>>> bool TraverseVariableInstantiations(VarTemplateDecl *D);
>>> - bool TraverseFunctionInstantiations(FunctionTemplateDecl *D) ;
>>> + bool TraverseFunctionInstantiations(FunctionTemplateDecl *D);
>>> bool TraverseTemplateArgumentLocsHelper(const
>>> TemplateArgumentLoc *TAL,
>>> unsigned Count);
>>> bool TraverseArrayTypeLocHelper(ArrayTypeLoc TL);
>>> @@ -429,27 +417,24 @@ private:
>>> bool TraverseVarHelper(VarDecl *D);
>>> bool TraverseOMPClause(OMPClause *C);
>>> bool TraverseOMPExecutableDirective(OMPExecutableDirective *S);
>>> -#define OPENMP_CLAUSE(Name, Class) \
>>> - bool Visit##Class(Class *C);
>>> +#define OPENMP_CLAUSE(Name, Class) bool Visit##Class(Class *C);
>>> #include "clang/Basic/OpenMPKinds.def"
>>> /// \brief Process clauses with list of variables.
>>> - template <typename T>
>>> - void VisitOMPClauseList(T *Node);
>>> + template <typename T> void VisitOMPClauseList(T *Node);
>>>
>>> typedef SmallVector<Stmt *, 16> StmtsTy;
>>> typedef SmallVector<StmtsTy *, 4> QueuesTy;
>>> -
>>> +
>>> QueuesTy Queues;
>>>
>>> class NewQueueRAII {
>>> RecursiveASTVisitor &RAV;
>>> +
>>> public:
>>> NewQueueRAII(StmtsTy &queue, RecursiveASTVisitor &RAV) :
>>> RAV(RAV) {
>>> RAV.Queues.push_back(&queue);
>>> }
>>> - ~NewQueueRAII() {
>>> - RAV.Queues.pop_back();
>>> - }
>>> + ~NewQueueRAII() { RAV.Queues.pop_back(); }
>>> };
>>>
>>> StmtsTy &getCurrentQueue() {
>>> @@ -460,20 +445,19 @@ private:
>>> public:
>>> class StmtQueueAction {
>>> StmtsTy &CurrQueue;
>>> +
>>> public:
>>> explicit StmtQueueAction(RecursiveASTVisitor &RAV)
>>> - : CurrQueue(RAV.getCurrentQueue()) { }
>>> + : CurrQueue(RAV.getCurrentQueue()) {}
>>>
>>> - void queue(Stmt *S) {
>>> - CurrQueue.push_back(S);
>>> - }
>>> + void queue(Stmt *S) { CurrQueue.push_back(S); }
>>> };
>>> };
>>>
>>> -#define DISPATCH(NAME, CLASS, VAR) \
>>> - return getDerived().Traverse##NAME(static_cast<CLASS*>(VAR))
>>> +#define DISPATCH(NAME, CLASS, VAR) \
>>> + return getDerived().Traverse##NAME(static_cast<CLASS *>(VAR))
>>>
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool RecursiveASTVisitor<Derived>::TraverseStmt(Stmt *S) {
>>> if (!S)
>>> return true;
>>> @@ -489,84 +473,89 @@ bool RecursiveASTVisitor<Derived>::Trave
>>>
>>> StmtsToEnqueu.clear();
>>>
>>> -#define DISPATCH_STMT(NAME, CLASS, VAR) \
>>> - TRY_TO(Traverse##NAME(static_cast<CLASS*>(VAR))); break
>>> +#define DISPATCH_STMT(NAME, CLASS, VAR) \
>>> + TRY_TO(Traverse##NAME(static_cast<CLASS *>(VAR)));
>>> \
>>> + break
>>>
>>> // If we have a binary expr, dispatch to the subcode of the
>>> binop. A smart
>>> // optimizer (e.g. LLVM) will fold this comparison into the
>>> switch stmt
>>> // below.
>>> if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(S)) {
>>> switch (BinOp->getOpcode()) {
>>> -#define OPERATOR(NAME) \
>>> - case BO_##NAME: DISPATCH_STMT(Bin##NAME, BinaryOperator, S);
>>> -
>>> - BINOP_LIST()
>>> +#define OPERATOR(NAME) \
>>> + case BO_##NAME: \
>>> + DISPATCH_STMT(Bin##NAME, BinaryOperator, S);
>>> +
>>> + BINOP_LIST()
>>> #undef OPERATOR
>>> #undef BINOP_LIST
>>> -
>>> -#define OPERATOR(NAME) \
>>> - case BO_##NAME##Assign: \
>>> - DISPATCH_STMT(Bin##NAME##Assign, CompoundAssignOperator,
>>> S);
>>> -
>>> - CAO_LIST()
>>> +
>>> +#define OPERATOR(NAME) \
>>> + case BO_##NAME##Assign: \
>>> + DISPATCH_STMT(Bin##NAME##Assign, CompoundAssignOperator, S);
>>> +
>>> + CAO_LIST()
>>> #undef OPERATOR
>>> #undef CAO_LIST
>>> }
>>> } else if (UnaryOperator *UnOp = dyn_cast<UnaryOperator>(S)) {
>>> switch (UnOp->getOpcode()) {
>>> -#define OPERATOR(NAME) \
>>> - case UO_##NAME: DISPATCH_STMT(Unary##NAME, UnaryOperator, S);
>>> -
>>> - UNARYOP_LIST()
>>> +#define OPERATOR(NAME) \
>>> + case UO_##NAME: \
>>> + DISPATCH_STMT(Unary##NAME, UnaryOperator, S);
>>> +
>>> + UNARYOP_LIST()
>>> #undef OPERATOR
>>> #undef UNARYOP_LIST
>>> }
>>> } else {
>>> -
>>> +
>>> // Top switch stmt: dispatch to TraverseFooStmt for each
>>> concrete FooStmt.
>>> switch (S->getStmtClass()) {
>>> - case Stmt::NoStmtClass: break;
>>> + case Stmt::NoStmtClass:
>>> + break;
>>> #define ABSTRACT_STMT(STMT)
>>> -#define STMT(CLASS, PARENT) \
>>> - case Stmt::CLASS##Class: DISPATCH_STMT(CLASS, CLASS, S);
>>> +#define STMT(CLASS, PARENT) \
>>> + case Stmt::CLASS##Class: \
>>> + DISPATCH_STMT(CLASS, CLASS, S);
>>> #include "clang/AST/StmtNodes.inc"
>>> }
>>> }
>>>
>>> - for (SmallVectorImpl<Stmt *>::reverse_iterator
>>> - RI = StmtsToEnqueu.rbegin(),
>>> - RE = StmtsToEnqueu.rend(); RI != RE; ++RI)
>>> + for (SmallVectorImpl<Stmt *>::reverse_iterator RI =
>>> StmtsToEnqueu.rbegin(),
>>> + RE =
>>> StmtsToEnqueu.rend();
>>> + RI != RE; ++RI)
>>> Queue.push_back(*RI);
>>> }
>>>
>>> return true;
>>> }
>>>
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool RecursiveASTVisitor<Derived>::TraverseType(QualType T) {
>>> if (T.isNull())
>>> return true;
>>>
>>> switch (T->getTypeClass()) {
>>> #define ABSTRACT_TYPE(CLASS, BASE)
>>> -#define TYPE(CLASS, BASE) \
>>> - case Type::CLASS: DISPATCH(CLASS##Type, CLASS##Type, \
>>> - const_cast<Type*>(T.getTypePtr()));
>>> +#define TYPE(CLASS, BASE) \
>>> + case Type::CLASS: \
>>> + DISPATCH(CLASS##Type, CLASS##Type, const_cast<Type
>>> *>(T.getTypePtr()));
>>> #include "clang/AST/TypeNodes.def"
>>> }
>>>
>>> return true;
>>> }
>>>
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool RecursiveASTVisitor<Derived>::TraverseTypeLoc(TypeLoc TL) {
>>> if (TL.isNull())
>>> return true;
>>>
>>> switch (TL.getTypeLocClass()) {
>>> #define ABSTRACT_TYPELOC(CLASS, BASE)
>>> -#define TYPELOC(CLASS, BASE) \
>>> - case TypeLoc::CLASS: \
>>> +#define TYPELOC(CLASS, BASE) \
>>> + case TypeLoc::CLASS: \
>>> return
>>> getDerived().Traverse##CLASS##TypeLoc(TL.castAs<CLASS##TypeLoc>());
>>> #include "clang/AST/TypeLocNodes.def"
>>> }
>>> @@ -574,13 +563,12 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> return true;
>>> }
>>>
>>> -
>>> // Define the Traverse*Attr(Attr* A) methods
>>> #define VISITORCLASS RecursiveASTVisitor
>>> #include "clang/AST/AttrVisitor.inc"
>>> #undef VISITORCLASS
>>>
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool RecursiveASTVisitor<Derived>::TraverseDecl(Decl *D) {
>>> if (!D)
>>> return true;
>>> @@ -593,10 +581,10 @@ bool RecursiveASTVisitor<Derived>::Trave
>>>
>>> switch (D->getKind()) {
>>> #define ABSTRACT_DECL(DECL)
>>> -#define DECL(CLASS, BASE) \
>>> - case Decl::CLASS: \
>>> - if
>>> (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl*>(D)))
>>> \
>>> - return false; \
>>> +#define DECL(CLASS, BASE) \
>>> + case Decl::CLASS: \
>>> + if
>>> (!getDerived().Traverse##CLASS##Decl(static_cast<CLASS##Decl
>>> *>(D))) \
>>> + return false; \
>>> break;
>>> #include "clang/AST/DeclNodes.inc"
>>> }
>>> @@ -611,9 +599,9 @@ bool RecursiveASTVisitor<Derived>::Trave
>>>
>>> #undef DISPATCH
>>>
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool RecursiveASTVisitor<Derived>::TraverseNestedNameSpecifier(
>>> - NestedNameSpecifier *NNS) {
>>> + NestedNameSpecifier *NNS) {
>>> if (!NNS)
>>> return true;
>>>
>>> @@ -635,14 +623,14 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> return true;
>>> }
>>>
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool RecursiveASTVisitor<Derived>::TraverseNestedNameSpecifierLoc(
>>> - NestedNameSpecifierLoc NNS) {
>>> + NestedNameSpecifierLoc NNS) {
>>> if (!NNS)
>>> return true;
>>>
>>> - if (NestedNameSpecifierLoc Prefix = NNS.getPrefix())
>>> - TRY_TO(TraverseNestedNameSpecifierLoc(Prefix));
>>> + if (NestedNameSpecifierLoc Prefix = NNS.getPrefix())
>>> + TRY_TO(TraverseNestedNameSpecifierLoc(Prefix));
>>>
>>> switch (NNS.getNestedNameSpecifier()->getKind()) {
>>> case NestedNameSpecifier::Identifier:
>>> @@ -660,9 +648,9 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> return true;
>>> }
>>>
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool RecursiveASTVisitor<Derived>::TraverseDeclarationNameInfo(
>>> - DeclarationNameInfo NameInfo) {
>>> + DeclarationNameInfo NameInfo) {
>>> switch (NameInfo.getName().getNameKind()) {
>>> case DeclarationName::CXXConstructorName:
>>> case DeclarationName::CXXDestructorName:
>>> @@ -685,7 +673,7 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> return true;
>>> }
>>>
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool
>>> RecursiveASTVisitor<Derived>::TraverseTemplateName(TemplateName
>>> Template) {
>>> if (DependentTemplateName *DTN =
>>> Template.getAsDependentTemplateName())
>>> TRY_TO(TraverseNestedNameSpecifier(DTN->getQualifier()));
>>> @@ -695,9 +683,9 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> return true;
>>> }
>>>
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool RecursiveASTVisitor<Derived>::TraverseTemplateArgument(
>>> - const
>>> TemplateArgument &Arg) {
>>> + const TemplateArgument &Arg) {
>>> switch (Arg.getKind()) {
>>> case TemplateArgument::Null:
>>> case TemplateArgument::Declaration:
>>> @@ -711,7 +699,7 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> case TemplateArgument::Template:
>>> case TemplateArgument::TemplateExpansion:
>>> return getDerived().TraverseTemplateName(
>>> - Arg.getAsTemplateOrTemplatePattern());
>>> + Arg.getAsTemplateOrTemplatePattern());
>>>
>>> case TemplateArgument::Expression:
>>> return getDerived().TraverseStmt(Arg.getAsExpr());
>>> @@ -726,9 +714,9 @@ bool RecursiveASTVisitor<Derived>::Trave
>>>
>>> // FIXME: no template name location?
>>> // FIXME: no source locations for a template argument pack?
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool RecursiveASTVisitor<Derived>::TraverseTemplateArgumentLoc(
>>> - const
>>> TemplateArgumentLoc &ArgLoc) {
>>> + const TemplateArgumentLoc &ArgLoc) {
>>> const TemplateArgument &Arg = ArgLoc.getArgument();
>>>
>>> switch (Arg.getKind()) {
>>> @@ -750,9 +738,9 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> case TemplateArgument::TemplateExpansion:
>>> if (ArgLoc.getTemplateQualifierLoc())
>>> TRY_TO(getDerived().TraverseNestedNameSpecifierLoc(
>>> - ArgLoc.getTemplateQualifierLoc()));
>>> + ArgLoc.getTemplateQualifierLoc()));
>>> return getDerived().TraverseTemplateName(
>>> - Arg.getAsTemplateOrTemplatePattern());
>>> + Arg.getAsTemplateOrTemplatePattern());
>>>
>>> case TemplateArgument::Expression:
>>> return getDerived().TraverseStmt(ArgLoc.getSourceExpression());
>>> @@ -765,10 +753,9 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> return true;
>>> }
>>>
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool RecursiveASTVisitor<Derived>::TraverseTemplateArguments(
>>> - const
>>> TemplateArgument *Args,
>>> - unsigned NumArgs) {
>>> + const TemplateArgument *Args, unsigned NumArgs) {
>>> for (unsigned I = 0; I != NumArgs; ++I) {
>>> TRY_TO(TraverseTemplateArgument(Args[I]));
>>> }
>>> @@ -776,9 +763,9 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> return true;
>>> }
>>>
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool RecursiveASTVisitor<Derived>::TraverseConstructorInitializer(
>>> - CXXCtorInitializer *Init) {
>>> + CXXCtorInitializer *Init) {
>>> if (TypeSourceInfo *TInfo = Init->getTypeSourceInfo())
>>> TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
>>>
>>> @@ -795,81 +782,64 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> // ----------------- Type traversal -----------------
>>>
>>> // This macro makes available a variable T, the passed-in type.
>>> -#define DEF_TRAVERSE_TYPE(TYPE, CODE) \
>>> - template<typename Derived> \
>>> - bool RecursiveASTVisitor<Derived>::Traverse##TYPE (TYPE *T) {
>>> \
>>> - TRY_TO(WalkUpFrom##TYPE (T)); \
>>> - { CODE; } \
>>> - return true; \
>>> - }
>>> -
>>> -DEF_TRAVERSE_TYPE(BuiltinType, { })
>>> -
>>> -DEF_TRAVERSE_TYPE(ComplexType, {
>>> - TRY_TO(TraverseType(T->getElementType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(PointerType, {
>>> - TRY_TO(TraverseType(T->getPointeeType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(BlockPointerType, {
>>> - TRY_TO(TraverseType(T->getPointeeType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(LValueReferenceType, {
>>> - TRY_TO(TraverseType(T->getPointeeType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(RValueReferenceType, {
>>> - TRY_TO(TraverseType(T->getPointeeType()));
>>> - })
>>> +#define DEF_TRAVERSE_TYPE(TYPE, CODE) \
>>> + template <typename Derived> \
>>> + bool RecursiveASTVisitor<Derived>::Traverse##TYPE(TYPE *T) {
>>> \
>>> + TRY_TO(WalkUpFrom##TYPE(T)); \
>>> + { CODE; } \
>>> + return true; \
>>> + }
>>> +
>>> +DEF_TRAVERSE_TYPE(BuiltinType, {})
>>> +
>>> +DEF_TRAVERSE_TYPE(ComplexType, {
>>> TRY_TO(TraverseType(T->getElementType())); })
>>> +
>>> +DEF_TRAVERSE_TYPE(PointerType, {
>>> TRY_TO(TraverseType(T->getPointeeType())); })
>>> +
>>> +DEF_TRAVERSE_TYPE(BlockPointerType,
>>> + { TRY_TO(TraverseType(T->getPointeeType())); })
>>> +
>>> +DEF_TRAVERSE_TYPE(LValueReferenceType,
>>> + { TRY_TO(TraverseType(T->getPointeeType())); })
>>> +
>>> +DEF_TRAVERSE_TYPE(RValueReferenceType,
>>> + { TRY_TO(TraverseType(T->getPointeeType())); })
>>>
>>> DEF_TRAVERSE_TYPE(MemberPointerType, {
>>> - TRY_TO(TraverseType(QualType(T->getClass(), 0)));
>>> - TRY_TO(TraverseType(T->getPointeeType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(DecayedType, {
>>> - TRY_TO(TraverseType(T->getOriginalType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(AdjustedType, {
>>> - TRY_TO(TraverseType(T->getOriginalType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(ConstantArrayType, {
>>> - TRY_TO(TraverseType(T->getElementType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(IncompleteArrayType, {
>>> - TRY_TO(TraverseType(T->getElementType()));
>>> - })
>>> + TRY_TO(TraverseType(QualType(T->getClass(), 0)));
>>> + TRY_TO(TraverseType(T->getPointeeType()));
>>> +})
>>> +
>>> +DEF_TRAVERSE_TYPE(DecayedType, {
>>> TRY_TO(TraverseType(T->getOriginalType())); })
>>> +
>>> +DEF_TRAVERSE_TYPE(AdjustedType, {
>>> TRY_TO(TraverseType(T->getOriginalType())); })
>>> +
>>> +DEF_TRAVERSE_TYPE(ConstantArrayType,
>>> + { TRY_TO(TraverseType(T->getElementType())); })
>>> +
>>> +DEF_TRAVERSE_TYPE(IncompleteArrayType,
>>> + { TRY_TO(TraverseType(T->getElementType())); })
>>>
>>> DEF_TRAVERSE_TYPE(VariableArrayType, {
>>> - TRY_TO(TraverseType(T->getElementType()));
>>> - TRY_TO(TraverseStmt(T->getSizeExpr()));
>>> - })
>>> + TRY_TO(TraverseType(T->getElementType()));
>>> + TRY_TO(TraverseStmt(T->getSizeExpr()));
>>> +})
>>>
>>> DEF_TRAVERSE_TYPE(DependentSizedArrayType, {
>>> - TRY_TO(TraverseType(T->getElementType()));
>>> - if (T->getSizeExpr())
>>> - TRY_TO(TraverseStmt(T->getSizeExpr()));
>>> - })
>>> + TRY_TO(TraverseType(T->getElementType()));
>>> + if (T->getSizeExpr())
>>> + TRY_TO(TraverseStmt(T->getSizeExpr()));
>>> +})
>>>
>>> DEF_TRAVERSE_TYPE(DependentSizedExtVectorType, {
>>> - if (T->getSizeExpr())
>>> - TRY_TO(TraverseStmt(T->getSizeExpr()));
>>> - TRY_TO(TraverseType(T->getElementType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(VectorType, {
>>> - TRY_TO(TraverseType(T->getElementType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(ExtVectorType, {
>>> - TRY_TO(TraverseType(T->getElementType()));
>>> - })
>>> + if (T->getSizeExpr())
>>> + TRY_TO(TraverseStmt(T->getSizeExpr()));
>>> + TRY_TO(TraverseType(T->getElementType()));
>>> +})
>>> +
>>> +DEF_TRAVERSE_TYPE(VectorType, {
>>> TRY_TO(TraverseType(T->getElementType())); })
>>> +
>>> +DEF_TRAVERSE_TYPE(ExtVectorType, {
>>> TRY_TO(TraverseType(T->getElementType())); })
>>>
>>> DEF_TRAVERSE_TYPE(FunctionNoProtoType,
>>> { TRY_TO(TraverseType(T->getReturnType())); })
>>> @@ -886,87 +856,72 @@ DEF_TRAVERSE_TYPE(FunctionProtoType, {
>>> }
>>> })
>>>
>>> -DEF_TRAVERSE_TYPE(UnresolvedUsingType, { })
>>> -DEF_TRAVERSE_TYPE(TypedefType, { })
>>> +DEF_TRAVERSE_TYPE(UnresolvedUsingType, {})
>>> +DEF_TRAVERSE_TYPE(TypedefType, {})
>>> +
>>> +DEF_TRAVERSE_TYPE(TypeOfExprType,
>>> + { TRY_TO(TraverseStmt(T->getUnderlyingExpr()));
>>> })
>>>
>>> -DEF_TRAVERSE_TYPE(TypeOfExprType, {
>>> - TRY_TO(TraverseStmt(T->getUnderlyingExpr()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(TypeOfType, {
>>> - TRY_TO(TraverseType(T->getUnderlyingType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(DecltypeType, {
>>> - TRY_TO(TraverseStmt(T->getUnderlyingExpr()));
>>> - })
>>> +DEF_TRAVERSE_TYPE(TypeOfType, {
>>> TRY_TO(TraverseType(T->getUnderlyingType())); })
>>> +
>>> +DEF_TRAVERSE_TYPE(DecltypeType,
>>> + { TRY_TO(TraverseStmt(T->getUnderlyingExpr()));
>>> })
>>>
>>> DEF_TRAVERSE_TYPE(UnaryTransformType, {
>>> - TRY_TO(TraverseType(T->getBaseType()));
>>> - TRY_TO(TraverseType(T->getUnderlyingType()));
>>> - })
>>> + TRY_TO(TraverseType(T->getBaseType()));
>>> + TRY_TO(TraverseType(T->getUnderlyingType()));
>>> +})
>>> +
>>> +DEF_TRAVERSE_TYPE(AutoType, {
>>> TRY_TO(TraverseType(T->getDeducedType())); })
>>>
>>> -DEF_TRAVERSE_TYPE(AutoType, {
>>> - TRY_TO(TraverseType(T->getDeducedType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(RecordType, { })
>>> -DEF_TRAVERSE_TYPE(EnumType, { })
>>> -DEF_TRAVERSE_TYPE(TemplateTypeParmType, { })
>>> -DEF_TRAVERSE_TYPE(SubstTemplateTypeParmType, { })
>>> -DEF_TRAVERSE_TYPE(SubstTemplateTypeParmPackType, { })
>>> +DEF_TRAVERSE_TYPE(RecordType, {})
>>> +DEF_TRAVERSE_TYPE(EnumType, {})
>>> +DEF_TRAVERSE_TYPE(TemplateTypeParmType, {})
>>> +DEF_TRAVERSE_TYPE(SubstTemplateTypeParmType, {})
>>> +DEF_TRAVERSE_TYPE(SubstTemplateTypeParmPackType, {})
>>>
>>> DEF_TRAVERSE_TYPE(TemplateSpecializationType, {
>>> - TRY_TO(TraverseTemplateName(T->getTemplateName()));
>>> - TRY_TO(TraverseTemplateArguments(T->getArgs(),
>>> T->getNumArgs()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(InjectedClassNameType, { })
>>> -
>>> -DEF_TRAVERSE_TYPE(AttributedType, {
>>> - TRY_TO(TraverseType(T->getModifiedType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(ParenType, {
>>> - TRY_TO(TraverseType(T->getInnerType()));
>>> - })
>>> + TRY_TO(TraverseTemplateName(T->getTemplateName()));
>>> + TRY_TO(TraverseTemplateArguments(T->getArgs(), T->getNumArgs()));
>>> +})
>>>
>>> -DEF_TRAVERSE_TYPE(ElaboratedType, {
>>> - if (T->getQualifier()) {
>>> - TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
>>> - }
>>> - TRY_TO(TraverseType(T->getNamedType()));
>>> - })
>>> +DEF_TRAVERSE_TYPE(InjectedClassNameType, {})
>>>
>>> -DEF_TRAVERSE_TYPE(DependentNameType, {
>>> +DEF_TRAVERSE_TYPE(AttributedType,
>>> + { TRY_TO(TraverseType(T->getModifiedType())); })
>>> +
>>> +DEF_TRAVERSE_TYPE(ParenType, {
>>> TRY_TO(TraverseType(T->getInnerType())); })
>>> +
>>> +DEF_TRAVERSE_TYPE(ElaboratedType, {
>>> + if (T->getQualifier()) {
>>> TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
>>> - })
>>> + }
>>> + TRY_TO(TraverseType(T->getNamedType()));
>>> +})
>>> +
>>> +DEF_TRAVERSE_TYPE(DependentNameType,
>>> + {
>>> TRY_TO(TraverseNestedNameSpecifier(T->getQualifier())); })
>>>
>>> DEF_TRAVERSE_TYPE(DependentTemplateSpecializationType, {
>>> - TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
>>> - TRY_TO(TraverseTemplateArguments(T->getArgs(),
>>> T->getNumArgs()));
>>> - })
>>> + TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
>>> + TRY_TO(TraverseTemplateArguments(T->getArgs(), T->getNumArgs()));
>>> +})
>>>
>>> -DEF_TRAVERSE_TYPE(PackExpansionType, {
>>> - TRY_TO(TraverseType(T->getPattern()));
>>> - })
>>> +DEF_TRAVERSE_TYPE(PackExpansionType, {
>>> TRY_TO(TraverseType(T->getPattern())); })
>>>
>>> -DEF_TRAVERSE_TYPE(ObjCInterfaceType, { })
>>> +DEF_TRAVERSE_TYPE(ObjCInterfaceType, {})
>>>
>>> DEF_TRAVERSE_TYPE(ObjCObjectType, {
>>> - // We have to watch out here because an ObjCInterfaceType's base
>>> - // type is itself.
>>> - if (T->getBaseType().getTypePtr() != T)
>>> - TRY_TO(TraverseType(T->getBaseType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(ObjCObjectPointerType, {
>>> - TRY_TO(TraverseType(T->getPointeeType()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPE(AtomicType, {
>>> - TRY_TO(TraverseType(T->getValueType()));
>>> - })
>>> + // We have to watch out here because an ObjCInterfaceType's base
>>> + // type is itself.
>>> + if (T->getBaseType().getTypePtr() != T)
>>> + TRY_TO(TraverseType(T->getBaseType()));
>>> +})
>>> +
>>> +DEF_TRAVERSE_TYPE(ObjCObjectPointerType,
>>> + { TRY_TO(TraverseType(T->getPointeeType())); })
>>> +
>>> +DEF_TRAVERSE_TYPE(AtomicType, {
>>> TRY_TO(TraverseType(T->getValueType())); })
>>>
>>> #undef DEF_TRAVERSE_TYPE
>>>
>>> @@ -977,19 +932,19 @@ DEF_TRAVERSE_TYPE(AtomicType, {
>>> // in addition to WalkUpFrom* for the TypeLoc itself, such that
>>> existing
>>> // clients that override the WalkUpFrom*Type() and/or
>>> Visit*Type() methods
>>> // continue to work.
>>> -#define DEF_TRAVERSE_TYPELOC(TYPE, CODE) \
>>> - template<typename Derived> \
>>> - bool
>>> RecursiveASTVisitor<Derived>::Traverse##TYPE##Loc(TYPE##Loc TL) { \
>>> - if (getDerived().shouldWalkTypesOfTypeLocs()) \
>>> - TRY_TO(WalkUpFrom##TYPE(const_cast<TYPE*>(TL.getTypePtr())));
>>> \
>>> - TRY_TO(WalkUpFrom##TYPE##Loc(TL)); \
>>> - { CODE; } \
>>> - return true; \
>>> +#define DEF_TRAVERSE_TYPELOC(TYPE, CODE) \
>>> + template <typename Derived> \
>>> + bool
>>> RecursiveASTVisitor<Derived>::Traverse##TYPE##Loc(TYPE##Loc TL) {
>>> \
>>> + if (getDerived().shouldWalkTypesOfTypeLocs())
>>> \
>>> + TRY_TO(WalkUpFrom##TYPE(const_cast<TYPE
>>> *>(TL.getTypePtr()))); \
>>> + TRY_TO(WalkUpFrom##TYPE##Loc(TL)); \
>>> + { CODE; } \
>>> + return true; \
>>> }
>>>
>>> -template<typename Derived>
>>> -bool RecursiveASTVisitor<Derived>::TraverseQualifiedTypeLoc(
>>> - QualifiedTypeLoc TL) {
>>> +template <typename Derived>
>>> +bool
>>> +RecursiveASTVisitor<Derived>::TraverseQualifiedTypeLoc(
>>> QualifiedTypeLoc
>>> TL) {
>>> // Move this over to the 'main' typeloc tree. Note that this is a
>>> // move -- we pretend that we were really looking at the
>>> unqualified
>>> // typeloc all along -- rather than a recursion, so we don't
>>> follow
>>> @@ -1008,46 +963,40 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> return TraverseTypeLoc(TL.getUnqualifiedLoc());
>>> }
>>>
>>> -DEF_TRAVERSE_TYPELOC(BuiltinType, { })
>>> +DEF_TRAVERSE_TYPELOC(BuiltinType, {})
>>>
>>> // FIXME: ComplexTypeLoc is unfinished
>>> DEF_TRAVERSE_TYPELOC(ComplexType, {
>>> - TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
>>> - })
>>> + TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
>>> +})
>>>
>>> -DEF_TRAVERSE_TYPELOC(PointerType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPELOC(BlockPointerType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPELOC(LValueReferenceType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPELOC(RValueReferenceType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
>>> - })
>>> +DEF_TRAVERSE_TYPELOC(PointerType,
>>> + {
>>> TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
>>> +
>>> +DEF_TRAVERSE_TYPELOC(BlockPointerType,
>>> + {
>>> TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
>>> +
>>> +DEF_TRAVERSE_TYPELOC(LValueReferenceType,
>>> + {
>>> TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
>>> +
>>> +DEF_TRAVERSE_TYPELOC(RValueReferenceType,
>>> + {
>>> TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
>>>
>>> // FIXME: location of base class?
>>> // We traverse this in the type case as well, but how is it not
>>> reached through
>>> // the pointee type?
>>> DEF_TRAVERSE_TYPELOC(MemberPointerType, {
>>> - TRY_TO(TraverseType(QualType(TL.getTypePtr()->getClass(), 0)));
>>> - TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPELOC(DecayedType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getOriginalLoc()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPELOC(AdjustedType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getOriginalLoc()));
>>> - })
>>> + TRY_TO(TraverseType(QualType(TL.getTypePtr()->getClass(), 0)));
>>> + TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
>>> +})
>>> +
>>> +DEF_TRAVERSE_TYPELOC(DecayedType,
>>> + {
>>> TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
>>>
>>> -template<typename Derived>
>>> +DEF_TRAVERSE_TYPELOC(AdjustedType,
>>> + {
>>> TRY_TO(TraverseTypeLoc(TL.getOriginalLoc())); })
>>> +
>>> +template <typename Derived>
>>> bool
>>> RecursiveASTVisitor<Derived>::TraverseArrayTypeLocHelper(
>>> ArrayTypeLoc
>>> TL) {
>>> // This isn't available for ArrayType, but is for the
>>> ArrayTypeLoc.
>>> TRY_TO(TraverseStmt(TL.getSizeExpr()));
>>> @@ -1055,156 +1004,147 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> }
>>>
>>> DEF_TRAVERSE_TYPELOC(ConstantArrayType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
>>> - return TraverseArrayTypeLocHelper(TL);
>>> - })
>>> + TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
>>> + return TraverseArrayTypeLocHelper(TL);
>>> +})
>>>
>>> DEF_TRAVERSE_TYPELOC(IncompleteArrayType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
>>> - return TraverseArrayTypeLocHelper(TL);
>>> - })
>>> + TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
>>> + return TraverseArrayTypeLocHelper(TL);
>>> +})
>>>
>>> DEF_TRAVERSE_TYPELOC(VariableArrayType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
>>> - return TraverseArrayTypeLocHelper(TL);
>>> - })
>>> + TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
>>> + return TraverseArrayTypeLocHelper(TL);
>>> +})
>>>
>>> DEF_TRAVERSE_TYPELOC(DependentSizedArrayType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
>>> - return TraverseArrayTypeLocHelper(TL);
>>> - })
>>> + TRY_TO(TraverseTypeLoc(TL.getElementLoc()));
>>> + return TraverseArrayTypeLocHelper(TL);
>>> +})
>>>
>>> // FIXME: order? why not size expr first?
>>> // FIXME: base VectorTypeLoc is unfinished
>>> DEF_TRAVERSE_TYPELOC(DependentSizedExtVectorType, {
>>> - if (TL.getTypePtr()->getSizeExpr())
>>> - TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
>>> - TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
>>> - })
>>> + if (TL.getTypePtr()->getSizeExpr())
>>> + TRY_TO(TraverseStmt(TL.getTypePtr()->getSizeExpr()));
>>> + TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
>>> +})
>>>
>>> // FIXME: VectorTypeLoc is unfinished
>>> DEF_TRAVERSE_TYPELOC(VectorType, {
>>> - TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
>>> - })
>>> + TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
>>> +})
>>>
>>> // FIXME: size and attributes
>>> // FIXME: base VectorTypeLoc is unfinished
>>> DEF_TRAVERSE_TYPELOC(ExtVectorType, {
>>> - TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
>>> - })
>>> + TRY_TO(TraverseType(TL.getTypePtr()->getElementType()));
>>> +})
>>>
>>> -DEF_TRAVERSE_TYPELOC(FunctionNoProtoType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
>>> - })
>>> +DEF_TRAVERSE_TYPELOC(FunctionNoProtoType,
>>> + { TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
>>> })
>>>
>>> // FIXME: location of exception specifications (attributes?)
>>> DEF_TRAVERSE_TYPELOC(FunctionProtoType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
>>> + TRY_TO(TraverseTypeLoc(TL.getReturnLoc()));
>>>
>>> - const FunctionProtoType *T = TL.getTypePtr();
>>> + const FunctionProtoType *T = TL.getTypePtr();
>>>
>>> - for (unsigned I = 0, E = TL.getNumParams(); I != E; ++I) {
>>> - if (TL.getParam(I)) {
>>> - TRY_TO(TraverseDecl(TL.getParam(I)));
>>> - } else if (I < T->getNumParams()) {
>>> - TRY_TO(TraverseType(T->getParamType(I)));
>>> - }
>>> + for (unsigned I = 0, E = TL.getNumParams(); I != E; ++I) {
>>> + if (TL.getParam(I)) {
>>> + TRY_TO(TraverseDecl(TL.getParam(I)));
>>> + } else if (I < T->getNumParams()) {
>>> + TRY_TO(TraverseType(T->getParamType(I)));
>>> }
>>> + }
>>>
>>> - for (const auto &E : T->exceptions()) {
>>> - TRY_TO(TraverseType(E));
>>> - }
>>> - })
>>> + for (const auto &E : T->exceptions()) {
>>> + TRY_TO(TraverseType(E));
>>> + }
>>> +})
>>>
>>> -DEF_TRAVERSE_TYPELOC(UnresolvedUsingType, { })
>>> -DEF_TRAVERSE_TYPELOC(TypedefType, { })
>>> +DEF_TRAVERSE_TYPELOC(UnresolvedUsingType, {})
>>> +DEF_TRAVERSE_TYPELOC(TypedefType, {})
>>>
>>> -DEF_TRAVERSE_TYPELOC(TypeOfExprType, {
>>> - TRY_TO(TraverseStmt(TL.getUnderlyingExpr()));
>>> - })
>>> +DEF_TRAVERSE_TYPELOC(TypeOfExprType,
>>> + {
>>> TRY_TO(TraverseStmt(TL.getUnderlyingExpr())); })
>>>
>>> DEF_TRAVERSE_TYPELOC(TypeOfType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
>>> - })
>>> + TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
>>> +})
>>>
>>> // FIXME: location of underlying expr
>>> DEF_TRAVERSE_TYPELOC(DecltypeType, {
>>> - TRY_TO(TraverseStmt(TL.getTypePtr()->getUnderlyingExpr()));
>>> - })
>>> + TRY_TO(TraverseStmt(TL.getTypePtr()->getUnderlyingExpr()));
>>> +})
>>>
>>> DEF_TRAVERSE_TYPELOC(UnaryTransformType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
>>> - })
>>> + TRY_TO(TraverseTypeLoc(TL.getUnderlyingTInfo()->getTypeLoc()));
>>> +})
>>>
>>> DEF_TRAVERSE_TYPELOC(AutoType, {
>>> - TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
>>> - })
>>> + TRY_TO(TraverseType(TL.getTypePtr()->getDeducedType()));
>>> +})
>>>
>>> -DEF_TRAVERSE_TYPELOC(RecordType, { })
>>> -DEF_TRAVERSE_TYPELOC(EnumType, { })
>>> -DEF_TRAVERSE_TYPELOC(TemplateTypeParmType, { })
>>> -DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmType, { })
>>> -DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmPackType, { })
>>> +DEF_TRAVERSE_TYPELOC(RecordType, {})
>>> +DEF_TRAVERSE_TYPELOC(EnumType, {})
>>> +DEF_TRAVERSE_TYPELOC(TemplateTypeParmType, {})
>>> +DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmType, {})
>>> +DEF_TRAVERSE_TYPELOC(SubstTemplateTypeParmPackType, {})
>>>
>>> // FIXME: use the loc for the template name?
>>> DEF_TRAVERSE_TYPELOC(TemplateSpecializationType, {
>>> - TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
>>> - for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
>>> - TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
>>> - }
>>> - })
>>> + TRY_TO(TraverseTemplateName(TL.getTypePtr()->getTemplateName()));
>>> + for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
>>> + TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
>>> + }
>>> +})
>>>
>>> -DEF_TRAVERSE_TYPELOC(InjectedClassNameType, { })
>>> +DEF_TRAVERSE_TYPELOC(InjectedClassNameType, {})
>>>
>>> -DEF_TRAVERSE_TYPELOC(ParenType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getInnerLoc()));
>>> - })
>>> +DEF_TRAVERSE_TYPELOC(ParenType, {
>>> TRY_TO(TraverseTypeLoc(TL.getInnerLoc())); })
>>>
>>> -DEF_TRAVERSE_TYPELOC(AttributedType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getModifiedLoc()));
>>> - })
>>> +DEF_TRAVERSE_TYPELOC(AttributedType,
>>> + {
>>> TRY_TO(TraverseTypeLoc(TL.getModifiedLoc())); })
>>>
>>> DEF_TRAVERSE_TYPELOC(ElaboratedType, {
>>> - if (TL.getQualifierLoc()) {
>>> - TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
>>> - }
>>> - TRY_TO(TraverseTypeLoc(TL.getNamedTypeLoc()));
>>> - })
>>> + if (TL.getQualifierLoc()) {
>>> + TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
>>> + }
>>> + TRY_TO(TraverseTypeLoc(TL.getNamedTypeLoc()));
>>> +})
>>>
>>> DEF_TRAVERSE_TYPELOC(DependentNameType, {
>>> - TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
>>> - })
>>> + TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
>>> +})
>>>
>>> DEF_TRAVERSE_TYPELOC(DependentTemplateSpecializationType, {
>>> - if (TL.getQualifierLoc()) {
>>> - TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
>>> - }
>>> + if (TL.getQualifierLoc()) {
>>> + TRY_TO(TraverseNestedNameSpecifierLoc(TL.getQualifierLoc()));
>>> + }
>>>
>>> - for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
>>> - TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
>>> - }
>>> - })
>>> + for (unsigned I = 0, E = TL.getNumArgs(); I != E; ++I) {
>>> + TRY_TO(TraverseTemplateArgumentLoc(TL.getArgLoc(I)));
>>> + }
>>> +})
>>>
>>> -DEF_TRAVERSE_TYPELOC(PackExpansionType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getPatternLoc()));
>>> - })
>>> +DEF_TRAVERSE_TYPELOC(PackExpansionType,
>>> + {
>>> TRY_TO(TraverseTypeLoc(TL.getPatternLoc())); })
>>>
>>> -DEF_TRAVERSE_TYPELOC(ObjCInterfaceType, { })
>>> +DEF_TRAVERSE_TYPELOC(ObjCInterfaceType, {})
>>>
>>> DEF_TRAVERSE_TYPELOC(ObjCObjectType, {
>>> - // We have to watch out here because an ObjCInterfaceType's base
>>> - // type is itself.
>>> - if (TL.getTypePtr()->getBaseType().getTypePtr() !=
>>> TL.getTypePtr())
>>> - TRY_TO(TraverseTypeLoc(TL.getBaseLoc()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPELOC(ObjCObjectPointerType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getPointeeLoc()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_TYPELOC(AtomicType, {
>>> - TRY_TO(TraverseTypeLoc(TL.getValueLoc()));
>>> - })
>>> + // We have to watch out here because an ObjCInterfaceType's base
>>> + // type is itself.
>>> + if (TL.getTypePtr()->getBaseType().getTypePtr() !=
>>> TL.getTypePtr())
>>> + TRY_TO(TraverseTypeLoc(TL.getBaseLoc()));
>>> +})
>>> +
>>> +DEF_TRAVERSE_TYPELOC(ObjCObjectPointerType,
>>> + {
>>> TRY_TO(TraverseTypeLoc(TL.getPointeeLoc())); })
>>> +
>>> +DEF_TRAVERSE_TYPELOC(AtomicType, {
>>> TRY_TO(TraverseTypeLoc(TL.getValueLoc())); })
>>>
>>> #undef DEF_TRAVERSE_TYPELOC
>>>
>>> @@ -1215,7 +1155,7 @@ DEF_TRAVERSE_TYPELOC(AtomicType, {
>>> // Therefore each Traverse* only needs to worry about children other
>>> // than those.
>>>
>>> -template<typename Derived>
>>> +template <typename Derived>
>>> bool
>>> RecursiveASTVisitor<Derived>::TraverseDeclContextHelper(DeclContext
>>> *DC)
>>> {
>>> if (!DC)
>>> return true;
>>> @@ -1231,131 +1171,121 @@ bool RecursiveASTVisitor<Derived>::Trave
>>> }
>>>
>>> // This macro makes available a variable D, the passed-in decl.
>>> -#define DEF_TRAVERSE_DECL(DECL, CODE) \
>>> -template<typename Derived> \
>>> -bool RecursiveASTVisitor<Derived>::Traverse##DECL (DECL *D) { \
>>> - TRY_TO(WalkUpFrom##DECL (D)); \
>>> - { CODE; } \
>>> - TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D))); \
>>> - return true; \
>>> -}
>>> +#define DEF_TRAVERSE_DECL(DECL, CODE) \
>>> + template <typename Derived> \
>>> + bool RecursiveASTVisitor<Derived>::Traverse##DECL(DECL *D) {
>>> \
>>> + TRY_TO(WalkUpFrom##DECL(D)); \
>>> + { CODE; } \
>>> + TRY_TO(TraverseDeclContextHelper(dyn_cast<DeclContext>(D)));
>>> \
>>> + return true; \
>>> + }
>>>
>>> -DEF_TRAVERSE_DECL(AccessSpecDecl, { })
>>> +DEF_TRAVERSE_DECL(AccessSpecDecl, {})
>>>
>>> DEF_TRAVERSE_DECL(BlockDecl, {
>>> - if (TypeSourceInfo *TInfo = D->getSignatureAsWritten())
>>> - TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
>>> - TRY_TO(TraverseStmt(D->getBody()));
>>> - // This return statement makes sure the traversal of nodes in
>>> - // decls_begin()/decls_end() (done in the DEF_TRAVERSE_DECL
>>> macro)
>>> - // is skipped - don't remove it.
>>> - return true;
>>> - })
>>> + if (TypeSourceInfo *TInfo = D->getSignatureAsWritten())
>>> + TRY_TO(TraverseTypeLoc(TInfo->getTypeLoc()));
>>> + TRY_TO(TraverseStmt(D->getBody()));
>>> + // This return statement makes sure the traversal of nodes in
>>> + // decls_begin()/decls_end() (done in the DEF_TRAVERSE_DECL macro)
>>> + // is skipped - don't remove it.
>>> + return true;
>>> +})
>>>
>>> DEF_TRAVERSE_DECL(CapturedDecl, {
>>> - TRY_TO(TraverseStmt(D->getBody()));
>>> - // This return statement makes sure the traversal of nodes in
>>> - // decls_begin()/decls_end() (done in the DEF_TRAVERSE_DECL
>>> macro)
>>> - // is skipped - don't remove it.
>>> - return true;
>>> - })
>>> + TRY_TO(TraverseStmt(D->getBody()));
>>> + // This return statement makes sure the traversal of nodes in
>>> + // decls_begin()/decls_end() (done in the DEF_TRAVERSE_DECL macro)
>>> + // is skipped - don't remove it.
>>> + return true;
>>> +})
>>>
>>> -DEF_TRAVERSE_DECL(EmptyDecl, { })
>>> +DEF_TRAVERSE_DECL(EmptyDecl, {})
>>>
>>> -DEF_TRAVERSE_DECL(FileScopeAsmDecl, {
>>> - TRY_TO(TraverseStmt(D->getAsmString()));
>>> - })
>>> +DEF_TRAVERSE_DECL(FileScopeAsmDecl,
>>> + { TRY_TO(TraverseStmt(D->getAsmString())); })
>>>
>>> -DEF_TRAVERSE_DECL(ImportDecl, { })
>>> +DEF_TRAVERSE_DECL(ImportDecl, {})
>>>
>>> DEF_TRAVERSE_DECL(FriendDecl, {
>>> - // Friend is either decl or a type.
>>> - if (D->getFriendType())
>>> - TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
>>> - else
>>> - TRY_TO(TraverseDecl(D->getFriendDecl()));
>>> - })
>>> + // Friend is either decl or a type.
>>> + if (D->getFriendType())
>>> + TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
>>> + else
>>> + TRY_TO(TraverseDecl(D->getFriendDecl()));
>>> +})
>>>
>>> DEF_TRAVERSE_DECL(FriendTemplateDecl, {
>>> - if (D->getFriendType())
>>> - TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
>>> - else
>>> - TRY_TO(TraverseDecl(D->getFriendDecl()));
>>> - for (unsigned I = 0, E = D->getNumTemplateParameters(); I <
>>> E; ++I) {
>>> - TemplateParameterList *TPL = D->getTemplateParameterList(I);
>>> - for (TemplateParameterList::iterator ITPL = TPL->begin(),
>>> - ETPL = TPL->end();
>>> - ITPL != ETPL; ++ITPL) {
>>> - TRY_TO(TraverseDecl(*ITPL));
>>> - }
>>> + if (D->getFriendType())
>>> + TRY_TO(TraverseTypeLoc(D->getFriendType()->getTypeLoc()));
>>> + else
>>> + TRY_TO(TraverseDecl(D->getFriendDecl()));
>>> + for (unsigned I = 0, E = D->getNumTemplateParameters(); I < E;
>>> ++I) {
>>> + TemplateParameterList *TPL = D->getTemplateParameterList(I);
>>> + for (TemplateParameterList::iterator ITPL = TPL->begin(),
>>> ETPL = TPL->end();
>>> + ITPL != ETPL; ++ITPL) {
>>> + TRY_TO(TraverseDecl(*ITPL));
>>> }
>>> - })
>>> + }
>>> +})
>>>
>>> -DEF_TRAVERSE_DECL(ClassScopeFunctionSpecializationDecl, {
>>> - TRY_TO(TraverseDecl(D->getSpecialization()));
>>> - })
>>> +DEF_TRAVERSE_DECL(ClassScopeFunctionSpecializationDecl,
>>> + { TRY_TO(TraverseDecl(D->getSpecialization()));
>>> })
>>>
>>> -DEF_TRAVERSE_DECL(LinkageSpecDecl, { })
>>> +DEF_TRAVERSE_DECL(LinkageSpecDecl, {})
>>>
>>> -DEF_TRAVERSE_DECL(ObjCPropertyImplDecl, {
>>> - // FIXME: implement this
>>> - })
>>> +DEF_TRAVERSE_DECL(ObjCPropertyImplDecl, {// FIXME: implement this
>>> + })
>>>
>>> DEF_TRAVERSE_DECL(StaticAssertDecl, {
>>> - TRY_TO(TraverseStmt(D->getAssertExpr()));
>>> - TRY_TO(TraverseStmt(D->getMessage()));
>>> - })
>>> -
>>> -DEF_TRAVERSE_DECL(TranslationUnitDecl, {
>>> - // Code in an unnamed namespace shows up automatically in
>>> - // decls_begin()/decls_end(). Thus we don't need to recurse on
>>> - // D->getAnonymousNamespace().
>>> - })
>>> + TRY_TO(TraverseStmt(D->getAssertExpr()));
>>> + TRY_TO(TraverseStmt(D->getMessage()));
>>> +})
>>>
>>> -DEF_TRAVERSE_DECL(NamespaceAliasDecl, {
>>> - // We shouldn't traverse an aliased namespace, since it will be
>>> - // defined (and, therefore, traversed) somewhere else.
>>> - //
>>> - // This return statement makes sure the traversal of nodes in
>>> - // decls_begin()/decls_end() (done in the DEF_TRAVERSE_DECL
>>> macro)
>>> - // is skipped - don't remove it.
>>> - return true;
>>> - })
>>> +DEF_TRAVERSE_DECL(
>>> + TranslationUnitDecl,
>>> + {// Code in an unnamed namespace shows up automatically in
>>>
>>> + // decls_begin()/decls_end(). Thus we don't need to recurse on
>>> + // D->getAnonymousNamespace().
>>> + })
>>>
>>> -DEF_TRAVERSE_DECL(LabelDecl, {
>>> - // There is no code in a LabelDecl.
>>> +DEF_TRAVERSE_DECL(NamespaceAliasDecl, {
>>> + // We shouldn't traverse an aliased namespace, since it will be
>>> + // defined (and, therefore, traversed) somewhere else.
>>> + //
>>>
>>> + // This return statement makes sure the traversal of nodes in
>>>
>>
>
> _______________________________________________
> 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/20140520/38343f9e/attachment.html>
More information about the cfe-commits
mailing list