Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 14 | pmbaty | 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_DEPENDENCYSCANNING_DEPENDENCYSCANNINGSERVICE_H |
||
| 10 | #define LLVM_CLANG_TOOLING_DEPENDENCYSCANNING_DEPENDENCYSCANNINGSERVICE_H |
||
| 11 | |||
| 12 | #include "clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h" |
||
| 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 the source files. |
||
| 23 | CanonicalPreprocessing, |
||
| 24 | |||
| 25 | /// This mode is used to compute the dependencies by running the preprocessor |
||
| 26 | /// with special kind of lexing after scanning header and source files to get |
||
| 27 | /// the minimum necessary preprocessor directives for evaluating includes. |
||
| 28 | DependencyDirectivesScan, |
||
| 29 | }; |
||
| 30 | |||
| 31 | /// The format that is output by the dependency scanner. |
||
| 32 | enum class ScanningOutputFormat { |
||
| 33 | /// This is the Makefile compatible dep format. This will include all of the |
||
| 34 | /// deps necessary for an implicit modules build, but won't include any |
||
| 35 | /// intermodule dependency information. |
||
| 36 | Make, |
||
| 37 | |||
| 38 | /// This outputs the full clang module dependency graph suitable for use for |
||
| 39 | /// explicitly building modules. |
||
| 40 | Full, |
||
| 41 | |||
| 42 | /// This outputs the dependency graph for standard c++ modules in P1689R5 |
||
| 43 | /// format. |
||
| 44 | P1689, |
||
| 45 | }; |
||
| 46 | |||
| 47 | /// The dependency scanning service contains shared configuration and state that |
||
| 48 | /// is used by the individual dependency scanning workers. |
||
| 49 | class DependencyScanningService { |
||
| 50 | public: |
||
| 51 | DependencyScanningService(ScanningMode Mode, ScanningOutputFormat Format, |
||
| 52 | bool OptimizeArgs = false, |
||
| 53 | bool EagerLoadModules = false); |
||
| 54 | |||
| 55 | ScanningMode getMode() const { return Mode; } |
||
| 56 | |||
| 57 | ScanningOutputFormat getFormat() const { return Format; } |
||
| 58 | |||
| 59 | bool canOptimizeArgs() const { return OptimizeArgs; } |
||
| 60 | |||
| 61 | bool shouldEagerLoadModules() const { return EagerLoadModules; } |
||
| 62 | |||
| 63 | DependencyScanningFilesystemSharedCache &getSharedCache() { |
||
| 64 | return SharedCache; |
||
| 65 | } |
||
| 66 | |||
| 67 | private: |
||
| 68 | const ScanningMode Mode; |
||
| 69 | const ScanningOutputFormat Format; |
||
| 70 | /// Whether to optimize the modules' command-line arguments. |
||
| 71 | const bool OptimizeArgs; |
||
| 72 | /// Whether to set up command-lines to load PCM files eagerly. |
||
| 73 | const bool EagerLoadModules; |
||
| 74 | /// The global file system cache. |
||
| 75 | DependencyScanningFilesystemSharedCache SharedCache; |
||
| 76 | }; |
||
| 77 | |||
| 78 | } // end namespace dependencies |
||
| 79 | } // end namespace tooling |
||
| 80 | } // end namespace clang |
||
| 81 | |||
| 82 | #endif // LLVM_CLANG_TOOLING_DEPENDENCYSCANNING_DEPENDENCYSCANNINGSERVICE_H |