1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
7 * This file is distributed under the University of Illinois Open Source
8 * License. See LICENSE.TXT for details.
15 #include "config_clang.h"
17 #include "../plugin.hxx"
19 using namespace clang
;
25 // These classes are used as base classes when building with LO_CLANG_SHARED_PLUGINS.
26 // Since plugin classes in that case should use just one shared RecursiveASTVisitor,
27 // sharedvisitor/generator.cxx will make these to be the base classes used, so that
28 // compiling the code doesn't spend a several minutes optimizing instances
29 // of RecursiveASTVisitor that will never get used.
32 class DummyRecursiveASTVisitor
35 // These need to be reimplemented, because plugins contain calls to them,
36 // but they should actually never get called in the shared-visitor mode.
37 // This could be autogenerated too, but it's probably simpler to just extend
38 // manually as needed.
39 bool TraverseDecl( Decl
* ) { return complain(); }
40 bool TraverseLinkageSpecDecl( LinkageSpecDecl
* ) { return complain(); }
41 bool TraverseStmt( Stmt
* ) { return complain(); }
42 bool TraverseIfStmt( IfStmt
* ) { return complain(); }
43 bool TraverseWhileStmt( WhileStmt
* ) { return complain(); }
44 bool TraverseDoStmt( DoStmt
* ) { return complain(); }
45 bool TraverseForStmt( ForStmt
* ) { return complain(); }
46 bool TraverseCXXForRangeStmt( CXXForRangeStmt
* ) { return complain(); }
47 bool TraverseConditionalOperator( ConditionalOperator
* ) { return complain(); }
48 bool TraverseCXXCatchStmt( CXXCatchStmt
* ) { return complain(); }
49 bool TraverseCXXDestructorDecl( CXXDestructorDecl
* ) { return complain(); }
50 bool TraverseFunctionDecl( FunctionDecl
* ) { return complain(); }
51 bool TraverseSwitchStmt( SwitchStmt
* ) { return complain(); }
52 bool TraverseImplicitCastExpr( ImplicitCastExpr
* ) { return complain(); }
53 bool TraverseCStyleCastExpr( CStyleCastExpr
* ) { return complain(); }
54 bool TraverseCXXStaticCastExpr( CXXStaticCastExpr
* ) { return complain(); }
55 bool TraverseCXXFunctionalCastExpr( CXXFunctionalCastExpr
* ) { return complain(); }
56 bool TraverseFriendDecl( FriendDecl
* ) { return complain(); }
57 bool TraverseTypeLoc( TypeLoc
) { return complain(); }
58 bool TraverseAlignedAttr( AlignedAttr
* ) { return complain(); }
60 bool complain() { assert(false && "should not be calling this in sharedplugin mode"); abort(); return false; }
63 template<typename Derived
>
64 class DummyFilteringPlugin
: public DummyRecursiveASTVisitor
<Derived
>, public Plugin
67 explicit DummyFilteringPlugin( const InstantiationData
& data
) : Plugin(data
) {}
70 template<typename Derived
>
71 class DummyFilteringRewritePlugin
: public DummyRecursiveASTVisitor
<Derived
>, public RewritePlugin
74 explicit DummyFilteringRewritePlugin( const InstantiationData
& data
) : RewritePlugin(data
) {}
79 #endif // DUMMYPLUGIN_H
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */