[cfe-dev] Calling runClangTidy

Alexander Kornienko alexfh at google.com
Tue Sep 30 00:58:48 PDT 2014


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).

On Tue, Sep 30, 2014 at 12:11 AM, Daniel Dilts <diltsman at gmail.com> wrote:

> 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);
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140930/42d97738/attachment.html>


More information about the cfe-dev mailing list