1515#include " clang/Tooling/DependencyScanning/DependencyScanningTool.h"
1616#include " clang/Tooling/DependencyScanning/DependencyScanningWorker.h"
1717#include " clang/Tooling/JSONCompilationDatabase.h"
18+ #include " clang/Tooling/Tooling.h"
1819#include " llvm/ADT/STLExtras.h"
1920#include " llvm/ADT/Twine.h"
2021#include " llvm/Support/CommandLine.h"
2425#include " llvm/Support/LLVMDriver.h"
2526#include " llvm/Support/Program.h"
2627#include " llvm/Support/Signals.h"
28+ #include " llvm/Support/TargetSelect.h"
2729#include " llvm/Support/ThreadPool.h"
2830#include " llvm/Support/Threading.h"
2931#include " llvm/Support/Timer.h"
@@ -795,6 +797,7 @@ getCompilationDatabase(int argc, char **argv, std::string &ErrorMessage) {
795797}
796798
797799int clang_scan_deps_main (int argc, char **argv, const llvm::ToolContext &) {
800+ llvm::InitializeAllTargetInfos ();
798801 std::string ErrorMessage;
799802 std::unique_ptr<tooling::CompilationDatabase> Compilations =
800803 getCompilationDatabase (argc, argv, ErrorMessage);
@@ -810,6 +813,8 @@ int clang_scan_deps_main(int argc, char **argv, const llvm::ToolContext &) {
810813 Compilations = expandResponseFiles (std::move (Compilations),
811814 llvm::vfs::getRealFileSystem ());
812815
816+ Compilations = inferTargetAndDriverMode (std::move (Compilations));
817+
813818 // The command options are rewritten to run Clang in preprocessor only mode.
814819 auto AdjustingCompilations =
815820 std::make_unique<tooling::ArgumentsAdjustingCompilations>(
0 commit comments