clang-tidy unit tests
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 2 07:45:01 PDT 2015
On Wed, Sep 2, 2015 at 10:44 AM, Alexander Kornienko <alexfh at google.com> wrote:
> 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.
I'll give it a shot, thank you!
~Aaron
>
> -- 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
More information about the cfe-commits
mailing list