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 <aa...@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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to