@@ -26,6 +26,9 @@ namespace llvm {
2626 class Triple ;
2727 class FileCollectorBase ;
2828 template <typename Fn> class function_ref ;
29+ namespace opt {
30+ class InputArgList ;
31+ }
2932 namespace vfs {
3033 class FileSystem ;
3134 class OutputBackend ;
@@ -51,6 +54,9 @@ namespace clang {
5154 class DeclarationName ;
5255 class CompilerInvocation ;
5356 class TargetOptions ;
57+ namespace driver {
58+ class Driver ;
59+ }
5460namespace tooling {
5561namespace dependencies {
5662 struct ModuleDeps ;
@@ -74,9 +80,11 @@ class EnumDecl;
7480class FuncDecl ;
7581class ImportDecl ;
7682class IRGenOptions ;
83+ class LangOptions ;
7784class ModuleDecl ;
7885struct ModuleDependencyID ;
7986class NominalTypeDecl ;
87+ class SearchPathOptions ;
8088class StructDecl ;
8189class SwiftLookupTable ;
8290class TypeDecl ;
@@ -196,6 +204,22 @@ class ClangImporter final : public ClangModuleLoader {
196204 llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> VFS,
197205 const std::vector<std::string> &CC1Args);
198206
207+ // / Creates a Clang Driver based on the Swift compiler options.
208+ // /
209+ // / \return a pair of the Clang Driver and the diagnostic engine, which needs
210+ // / to be alive during the use of the Driver.
211+ static std::pair<clang::driver::Driver,
212+ llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine>>
213+ createClangDriver (
214+ const LangOptions &LangOpts,
215+ const ClangImporterOptions &ClangImporterOpts,
216+ llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> vfs = nullptr );
217+
218+ static llvm::opt::InputArgList
219+ createClangArgs (const ClangImporterOptions &ClangImporterOpts,
220+ const SearchPathOptions &SearchPathOpts,
221+ clang::driver::Driver &clangDriver);
222+
199223 ClangImporter (const ClangImporter &) = delete ;
200224 ClangImporter (ClangImporter &&) = delete ;
201225 ClangImporter &operator =(const ClangImporter &) = delete ;
0 commit comments