clang-tidy unit tests
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 2 07:44:12 PDT 2015
Looks like we need to call both ClangTidyContext::setASTContext,
ClangTidyCheck::registerMatchers and ClangTidyContext::setCurrentFile
in TestClangTidyAction::CreateASTConsumer. Maybe something else will need
to move there as well.
-- Alex
On Wed, Sep 2, 2015 at 4:09 PM, Aaron Ballman <aaron at aaronballman.com>
wrote:
> I ran into an issue with the runCheckOnCode() function from
> clang-tidy's unit tests, and I am not familiar enough with the way
> tool invocation works to suggest a correct fix.
>
> ClangTidyContext::setASTContext() is what sets up the language options
> for the ClangTidyContext object currently. However, runCheckOnCode()
> does not end up calling setASTContext() at any point. So when unit
> testing code, it behaves differently than when running clang-tidy.
>
> I am guessing that setting the language options should be separated
> from setting the AST context, however, I'm not certain of the proper
> way to accomplish this. As best I can tell, by the time
> registerMatchers() is called in runCheckOnCode(), we don't have access
> to a LangOptions object that's valid.
>
> Suggestions?
>
> ~Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150902/2b7d713a/attachment.html>
More information about the cfe-commits
mailing list