[PATCH] D16535: [clang-tidy] Check to find unintended semicolons that changes the semantics.
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 26 06:47:00 PST 2016
alexfh added a comment.
In http://reviews.llvm.org/D16535#362761, @xazax.hun wrote:
> In http://reviews.llvm.org/D16535#362726, @alexfh wrote:
> > I think, the check can be submitted as is and guards against spurious errors on invalid AST can be added as a follow up.
> This check is already submitted.
Yup, /me needs to sleep more ;)
> However I did not found any API in tidy to check whether the compilation failed. It would be great to be able to query that information at the time of registering matchers.
This information is not available when registering matchers, since this happens before parsing. You can use `isInvalidDecl()` to check whether particular declaration had any errors, or `Result.Context->getTranslationUnitDecl()->isInvalidDecl()` to check the whole translation unit.
> I have one more question though: does it make sense to run clang tidy at all, when the compilation failed? Isn't it a better default behaviour to not to run any of the checks in that case?
There are some valid use cases for running checks on a non-compilable code, e.g. editor integration.
More information about the cfe-commits