1 //===- DependencyScanningService.h - clang-scan-deps service ===-*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_TOOLING_DEPENDENCY_SCANNING_SERVICE_H
10 #define LLVM_CLANG_TOOLING_DEPENDENCY_SCANNING_SERVICE_H
12 #include "clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h"
16 namespace dependencies {
18 /// The mode in which the dependency scanner will operate to find the
20 enum class ScanningMode {
21 /// This mode is used to compute the dependencies by running the preprocessor
23 /// the unmodified source files.
24 CanonicalPreprocessing,
26 /// This mode is used to compute the dependencies by running the preprocessor
28 /// the source files that have been minimized to contents that might affect
30 MinimizedSourcePreprocessing
33 /// The dependency scanning service contains the shared state that is used by
34 /// the invidual dependency scanning workers.
35 class DependencyScanningService {
37 DependencyScanningService(ScanningMode Mode, bool ReuseFileManager = true,
38 bool SkipExcludedPPRanges = true);
40 ScanningMode getMode() const { return Mode; }
42 bool canReuseFileManager() const { return ReuseFileManager; }
44 bool canSkipExcludedPPRanges() const { return SkipExcludedPPRanges; }
46 DependencyScanningFilesystemSharedCache &getSharedCache() {
51 const ScanningMode Mode;
52 const bool ReuseFileManager;
53 /// Set to true to use the preprocessor optimization that skips excluded PP
54 /// ranges by bumping the buffer pointer in the lexer instead of lexing the
55 /// tokens in the range until reaching the corresponding directive.
56 const bool SkipExcludedPPRanges;
57 /// The global file system cache.
58 DependencyScanningFilesystemSharedCache SharedCache;
61 } // end namespace dependencies
62 } // end namespace tooling
63 } // end namespace clang
65 #endif // LLVM_CLANG_TOOLING_DEPENDENCY_SCANNING_SERVICE_H