1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #include "clang/AST/ASTConsumer.h"
9 #include "clang/AST/ASTContext.h"
10 #include "clang/AST/RecursiveASTVisitor.h"
11 #include "clang/ASTMatchers/ASTMatchFinder.h"
12 #include "clang/ASTMatchers/ASTMatchers.h"
13 #include "clang/Analysis/CFG.h"
14 #include "clang/Basic/Version.h"
15 #include "clang/Frontend/CompilerInstance.h"
16 #include "clang/Frontend/MultiplexConsumer.h"
17 #include "clang/Sema/Sema.h"
18 #include "llvm/ADT/DenseMap.h"
19 #include "llvm/Support/FileSystem.h"
20 #include "llvm/Support/Path.h"
24 #define CLANG_VERSION_FULL (CLANG_VERSION_MAJOR * 100 + CLANG_VERSION_MINOR)
27 using namespace clang
;
28 using namespace clang::ast_matchers
;
30 #if CLANG_VERSION_FULL >= 306
31 typedef std::unique_ptr
<ASTConsumer
> ASTConsumerPtr
;
33 typedef ASTConsumer
*ASTConsumerPtr
;
36 #if CLANG_VERSION_FULL < 800
37 // Starting with Clang 8.0 some basic functions have been renamed
38 #define getBeginLoc getLocStart
39 #define getEndLoc getLocEnd
42 // In order to support running our checks using clang-tidy, we implement a
43 // source compatible base check class called BaseCheck, and we use the
44 // preprocessor to decide which base class to pick.
46 #if CLANG_VERSION_FULL >= 900
47 #include "../ClangTidyCheck.h"
49 #include "../ClangTidy.h"
51 typedef clang::tidy::ClangTidyCheck BaseCheck
;
52 typedef clang::tidy::ClangTidyContext ContextType
;
54 #include "BaseCheck.h"