summaryrefslogtreecommitdiff
path: root/compilerplugins/clang/plugin.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'compilerplugins/clang/plugin.hxx')
-rw-r--r--compilerplugins/clang/plugin.hxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/compilerplugins/clang/plugin.hxx b/compilerplugins/clang/plugin.hxx
index 361bca922035..2d43371feede 100644
--- a/compilerplugins/clang/plugin.hxx
+++ b/compilerplugins/clang/plugin.hxx
@@ -18,6 +18,8 @@
#include <clang/Basic/SourceManager.h>
#include <clang/Frontend/CompilerInstance.h>
#include <clang/Lex/Preprocessor.h>
+
+#include <memory>
#include <unordered_map>
#include <vector>
@@ -26,6 +28,10 @@
#include "compat.hxx"
#include "pluginhandler.hxx"
+#if CLANG_VERSION >= 110000
+#include "clang/AST/ParentMapContext.h"
+#endif
+
using namespace clang;
using namespace llvm;
@@ -78,8 +84,11 @@ protected:
Returns the parent of the given AST node. Clang's internal AST representation doesn't provide this information,
it can only provide children, but getting the parent is often useful for inspecting a part of the AST.
*/
+ compat::DynTypedNodeList getParents(Decl const & decl);
+ compat::DynTypedNodeList getParents(Stmt const & stmt);
const Stmt* getParentStmt( const Stmt* stmt );
Stmt* getParentStmt( Stmt* stmt );
+ const Decl* getFunctionDeclContext(const Stmt* stmt);
const FunctionDecl* getParentFunctionDecl( const Stmt* stmt );
/**
@@ -112,6 +121,10 @@ private:
enum { isRewriter = false };
const char* name;
+
+#if CLANG_VERSION >= 110000
+ std::unique_ptr<ParentMapContext> parentMapContext_;
+#endif
};
template<typename Derived>
@@ -309,8 +322,6 @@ bool hasExternalLinkage(VarDecl const * decl);
bool isSmartPointerType(const clang::Type*);
bool isSmartPointerType(const Expr*);
-const Decl* getFunctionDeclContext(ASTContext& context, const Stmt* stmt);
-
} // namespace
#endif // COMPILEPLUGIN_H