2016-12-18 00:35:53 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef plugin_h__
|
|
|
|
#define plugin_h__
|
|
|
|
|
|
|
|
#include "clang/AST/ASTConsumer.h"
|
|
|
|
#include "clang/AST/ASTContext.h"
|
|
|
|
#include "clang/AST/RecursiveASTVisitor.h"
|
|
|
|
#include "clang/ASTMatchers/ASTMatchFinder.h"
|
|
|
|
#include "clang/ASTMatchers/ASTMatchers.h"
|
2017-10-20 20:11:50 +03:00
|
|
|
#include "clang/Analysis/CFG.h"
|
2016-12-18 00:35:53 +03:00
|
|
|
#include "clang/Basic/Version.h"
|
|
|
|
#include "clang/Frontend/CompilerInstance.h"
|
|
|
|
#include "clang/Frontend/MultiplexConsumer.h"
|
|
|
|
#include "clang/Sema/Sema.h"
|
|
|
|
#include "llvm/ADT/DenseMap.h"
|
|
|
|
#include "llvm/Support/FileSystem.h"
|
|
|
|
#include "llvm/Support/Path.h"
|
|
|
|
#include <iterator>
|
2017-10-20 20:11:50 +03:00
|
|
|
#include <memory>
|
2016-12-18 00:35:53 +03:00
|
|
|
|
|
|
|
#define CLANG_VERSION_FULL (CLANG_VERSION_MAJOR * 100 + CLANG_VERSION_MINOR)
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
using namespace clang;
|
|
|
|
using namespace clang::ast_matchers;
|
|
|
|
|
|
|
|
#if CLANG_VERSION_FULL >= 306
|
|
|
|
typedef std::unique_ptr<ASTConsumer> ASTConsumerPtr;
|
|
|
|
#else
|
|
|
|
typedef ASTConsumer *ASTConsumerPtr;
|
|
|
|
#endif
|
|
|
|
|
2018-11-03 16:41:36 +03:00
|
|
|
#if CLANG_VERSION_FULL < 800
|
|
|
|
// Starting with Clang 8.0 some basic functions have been renamed
|
|
|
|
#define getBeginLoc getLocStart
|
|
|
|
#define getEndLoc getLocEnd
|
|
|
|
#endif
|
|
|
|
|
2017-10-20 20:11:50 +03:00
|
|
|
// In order to support running our checks using clang-tidy, we implement a
|
|
|
|
// source compatible base check class called BaseCheck, and we use the
|
|
|
|
// preprocessor to decide which base class to pick.
|
2016-12-18 05:14:37 +03:00
|
|
|
#ifdef CLANG_TIDY
|
2020-07-06 19:31:17 +03:00
|
|
|
#if CLANG_VERSION_FULL >= 900
|
|
|
|
#include "../ClangTidyCheck.h"
|
|
|
|
#else
|
2016-12-18 05:14:37 +03:00
|
|
|
#include "../ClangTidy.h"
|
2020-07-06 19:31:17 +03:00
|
|
|
#endif
|
2019-10-31 15:16:35 +03:00
|
|
|
typedef clang::tidy::ClangTidyCheck BaseCheck;
|
2016-12-18 05:14:37 +03:00
|
|
|
typedef clang::tidy::ClangTidyContext ContextType;
|
|
|
|
#else
|
|
|
|
#include "BaseCheck.h"
|
|
|
|
#endif
|
2019-09-24 20:27:02 +03:00
|
|
|
|
|
|
|
#endif // plugin_h__
|