@@ -284,7 +284,8 @@ class ClangTidyRunner
284284 // Given a work-queue in/out-file, process it. Using system() for portability.
285285 // Empties work_queue.
286286 void RunClangTidyOn (ContentAddressedStore& output_store,
287- std::list<filepath_contenthash_t >* work_queue)
287+ std::list<filepath_contenthash_t >* work_queue,
288+ std::string_view compile_json_str)
288289 {
289290 if (work_queue->empty ()) {
290291 return ;
@@ -321,9 +322,10 @@ class ClangTidyRunner
321322 const std::string tmp_out = final_out.string () + uniquifier + " .tmp" ;
322323 // Putting the file to clang-tidy early in the command line so that
323324 // it is easy to find with `ps` or `top`.
324- const std::string command = clang_tidy_ + " '" + work.first .string ()
325- + " '" + clang_tidy_args_ + " > '" + tmp_out
326- + " ' 2>/dev/null" ;
325+ const std::string command
326+ = clang_tidy_ + " -p " + std::string (compile_json_str) + " '"
327+ + work.first .string () + " '" + clang_tidy_args_ + " > '" + tmp_out
328+ + " ' 2>/dev/null" ;
327329 const int r = system (command.c_str ());
328330#ifdef WIFSIGNALED
329331 // NOLINTBEGIN
@@ -658,7 +660,7 @@ int main(int argc, char* argv[])
658660 auto work_list = cc_file_gatherer.BuildWorkList (build_env_latest_change);
659661
660662 // Now the expensive part...
661- runner.RunClangTidyOn (store, &work_list);
663+ runner.RunClangTidyOn (store, &work_list, compile_json_str );
662664
663665 const std::string detailed_report = cache_prefix + " clang-tidy.out" ;
664666 const std::string summary = cache_prefix + " clang-tidy.summary" ;
0 commit comments