[cfe-dev] Calling runClangTidy

Daniel Dilts diltsman at gmail.com
Mon Sep 29 13:11:18 PDT 2014


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<DefaultOptionsProvider>(globalOptions, options);
   std::vector<std::string> files{ "class_name.cpp" };
   std::vector<ClangTidyError> errors;
   auto stats = runClangTidy(std::move(optionsProvider), *db, files,
&errors);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140929/70b7122e/attachment.html>


More information about the cfe-dev mailing list