Calling runClangTidy

I am attempting to directly integrate with clang-tidy. I am attempting to call runClangTidy with a set of parameters that, to the best I can tell, match what it gets called with when clang-tidy calls it. clang-tidy returns 2x ClangTidyError objects, but mine returns none. I would appreciate any comments on what I could be doing wrong in the following code. I am linking against rev 218612.

std::string error;
auto db = JSONCompilationDatabase::loadFromBuffer(R"(
[
{
“directory”: “D:/llvm”,
“command” : “D:/llvm/build/Debug/bin/clang.exe class_name.cpp”,
“file” : “class_name.cpp”
}
]
)", error);
ClangTidyGlobalOptions globalOptions{{}};
auto options = ClangTidyOptions::getDefaults();
options.Checks = “,-clang-analyzer-alpha,-llvm-include-order,-google-*,”;
options.User = “DiltsDa”;
auto optionsProvider = llvm::make_unique(globalOptions, options);
std::vectorstd::string files{ “class_name.cpp” };
std::vector errors;
auto stats = runClangTidy(std::move(optionsProvider), *db, files, &errors);

+alexfh

You should make sure that all modules are linked with your binary the same way as it happens with tool/ClangTidyMain.cpp (the weird extern volatile variables around lines 244-254).