diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp index 273e4b97b73..e5d043c5ecb 100644 --- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp +++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp @@ -286,7 +286,8 @@ static void printProfileData(const ProfileData &Profile, OS.flush(); } -static std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider() { +static std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider( + llvm::IntrusiveRefCntPtr<vfs::FileSystem> FS) { ClangTidyGlobalOptions GlobalOptions; if (std::error_code Err = parseLineFilter(LineFilter, GlobalOptions)) { llvm::errs() << "Invalid LineFilter: " << Err.message() << "\n\nUsage:\n"; @@ -334,7 +335,7 @@ static std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider() { } } return llvm::make_unique<FileOptionsProvider>(GlobalOptions, DefaultOptions, - OverrideOptions); + OverrideOptions, std::move(FS)); } llvm::IntrusiveRefCntPtr<vfs::FileSystem> @@ -364,8 +365,13 @@ getVfsOverlayFromFile(const std::string &OverlayFile) { static int clangTidyMain(int argc, const char **argv) { CommonOptionsParser OptionsParser(argc, argv, ClangTidyCategory, cl::ZeroOrMore); + llvm::IntrusiveRefCntPtr<vfs::FileSystem> BaseFS( + VfsOverlay.empty() ? vfs::getRealFileSystem() + : getVfsOverlayFromFile(VfsOverlay)); + if (!BaseFS) + return 1; - auto OwningOptionsProvider = createOptionsProvider(); + auto OwningOptionsProvider = createOptionsProvider(BaseFS); auto *OptionsProvider = OwningOptionsProvider.get(); if (!OptionsProvider) return 1; @@ -432,12 +438,6 @@ static int clangTidyMain(int argc, const char **argv) { llvm::cl::PrintHelpMessage(/*Hidden=*/false, /*Categorized=*/true); return 1; } - llvm::IntrusiveRefCntPtr<vfs::FileSystem> BaseFS( - VfsOverlay.empty() ? vfs::getRealFileSystem() - : getVfsOverlayFromFile(VfsOverlay)); - if (!BaseFS) - return 1; - ProfileData Profile; llvm::InitializeAllTargetInfos(); |

