9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_RESTRICTINCLUDESSCHECK_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_RESTRICTINCLUDESSCHECK_H
12 #include "../ClangTidyCheck.h"
13 #include "../GlobList.h"
14 #include "clang/Lex/PPCallbacks.h"
18 namespace portability {
28 std::string DefaultAllowedIncludes =
"*")
30 AllowedIncludes(
Options.get(
"Includes", DefaultAllowedIncludes)),
31 AllowedIncludesGlobList(AllowedIncludes) {}
34 Preprocessor *ModuleExpanderPP)
override;
41 std::string AllowedIncludes;
48 const SourceManager &SM)
49 : Check(Check), SM(SM) {}
53 CharSourceRange FilenameRange,
const FileEntry *File,
54 StringRef SearchPath, StringRef RelativePath,
55 const Module *Imported,
56 SrcMgr::CharacteristicKind FileType)
override;
60 struct IncludeDirective {
61 IncludeDirective() =
default;
62 IncludeDirective(SourceLocation
Loc, CharSourceRange
Range,
63 StringRef
Filename, StringRef FullPath,
bool IsInMainFile)
65 IsInMainFile(IsInMainFile) {}
68 CharSourceRange
Range;
69 std::string IncludeFile;
70 std::string IncludePath;
74 using FileIncludes = llvm::SmallVector<IncludeDirective, 8>;
75 llvm::SmallDenseMap<FileID, FileIncludes> IncludeDirectives;
77 RestrictSystemIncludesCheck &Check;
78 const SourceManager &SM;
85 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_RESTRICTINCLUDESSCHECK_H