clang  14.0.0git
DependencyScanningService.h
Go to the documentation of this file.
1 //===- DependencyScanningService.h - clang-scan-deps service ===-*- C++ -*-===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLVM_CLANG_TOOLING_DEPENDENCY_SCANNING_SERVICE_H
10 #define LLVM_CLANG_TOOLING_DEPENDENCY_SCANNING_SERVICE_H
11 
13 
14 namespace clang {
15 namespace tooling {
16 namespace dependencies {
17 
18 /// The mode in which the dependency scanner will operate to find the
19 /// dependencies.
20 enum class ScanningMode {
21  /// This mode is used to compute the dependencies by running the preprocessor
22  /// over
23  /// the unmodified source files.
25 
26  /// This mode is used to compute the dependencies by running the preprocessor
27  /// over
28  /// the source files that have been minimized to contents that might affect
29  /// the dependencies.
31 };
32 
33 /// The format that is output by the dependency scanner.
35  /// This is the Makefile compatible dep format. This will include all of the
36  /// deps necessary for an implicit modules build, but won't include any
37  /// intermodule dependency information.
38  Make,
39 
40  /// This outputs the full module dependency graph suitable for use for
41  /// explicitly building modules.
42  Full,
43 };
44 
45 /// The dependency scanning service contains the shared state that is used by
46 /// the invidual dependency scanning workers.
48 public:
50  bool ReuseFileManager = true,
51  bool SkipExcludedPPRanges = true,
52  bool OptimizeArgs = false);
53 
54  ScanningMode getMode() const { return Mode; }
55 
56  ScanningOutputFormat getFormat() const { return Format; }
57 
58  bool canReuseFileManager() const { return ReuseFileManager; }
59 
60  bool canSkipExcludedPPRanges() const { return SkipExcludedPPRanges; }
61 
62  bool canOptimizeArgs() const { return OptimizeArgs; }
63 
65  return SharedCache;
66  }
67 
68 private:
69  const ScanningMode Mode;
70  const ScanningOutputFormat Format;
71  const bool ReuseFileManager;
72  /// Set to true to use the preprocessor optimization that skips excluded PP
73  /// ranges by bumping the buffer pointer in the lexer instead of lexing the
74  /// tokens in the range until reaching the corresponding directive.
75  const bool SkipExcludedPPRanges;
76  /// Whether to optimize the modules' command-line arguments.
77  const bool OptimizeArgs;
78  /// The global file system cache.
80 };
81 
82 } // end namespace dependencies
83 } // end namespace tooling
84 } // end namespace clang
85 
86 #endif // LLVM_CLANG_TOOLING_DEPENDENCY_SCANNING_SERVICE_H
clang::tooling::dependencies::DependencyScanningService::canReuseFileManager
bool canReuseFileManager() const
Definition: DependencyScanningService.h:58
clang::tooling::dependencies::DependencyScanningService::getFormat
ScanningOutputFormat getFormat() const
Definition: DependencyScanningService.h:56
clang::tooling::dependencies::ScanningOutputFormat
ScanningOutputFormat
The format that is output by the dependency scanner.
Definition: DependencyScanningService.h:34
clang::tooling::dependencies::DependencyScanningService::DependencyScanningService
DependencyScanningService(ScanningMode Mode, ScanningOutputFormat Format, bool ReuseFileManager=true, bool SkipExcludedPPRanges=true, bool OptimizeArgs=false)
Definition: DependencyScanningService.cpp:16
clang::tooling::dependencies::DependencyScanningService::getMode
ScanningMode getMode() const
Definition: DependencyScanningService.h:54
clang::tooling::dependencies::ScanningMode::MinimizedSourcePreprocessing
@ MinimizedSourcePreprocessing
This mode is used to compute the dependencies by running the preprocessor over the source files that ...
clang::tooling::dependencies::DependencyScanningService::getSharedCache
DependencyScanningFilesystemSharedCache & getSharedCache()
Definition: DependencyScanningService.h:64
clang::tooling::dependencies::DependencyScanningFilesystemSharedCache
This class is a shared cache, that caches the 'stat' and 'open' calls to the underlying real file sys...
Definition: DependencyScanningFilesystem.h:111
clang::tooling::dependencies::ScanningMode
ScanningMode
The mode in which the dependency scanner will operate to find the dependencies.
Definition: DependencyScanningService.h:20
clang::tooling::dependencies::DependencyScanningService
The dependency scanning service contains the shared state that is used by the invidual dependency sca...
Definition: DependencyScanningService.h:47
clang::tooling::dependencies::DependencyScanningService::canOptimizeArgs
bool canOptimizeArgs() const
Definition: DependencyScanningService.h:62
clang::tooling::dependencies::ScanningOutputFormat::Make
@ Make
This is the Makefile compatible dep format.
clang
Definition: CalledOnceCheck.h:17
clang::tooling::dependencies::ScanningMode::CanonicalPreprocessing
@ CanonicalPreprocessing
This mode is used to compute the dependencies by running the preprocessor over the unmodified source ...
DependencyScanningFilesystem.h
clang::tooling::dependencies::ScanningOutputFormat::Full
@ Full
This outputs the full module dependency graph suitable for use for explicitly building modules.
clang::tooling::dependencies::DependencyScanningService::canSkipExcludedPPRanges
bool canSkipExcludedPPRanges() const
Definition: DependencyScanningService.h:60