clang-tidy unit tests

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 2 07:09:09 PDT 2015


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