This is an archive of the discontinued LLVM Phabricator instance.

[PATCH] Expose AST language options to checkers
ClosedPublic

Authored by aaron.ballman on Aug 27 2015, 12:22 PM.

Details

Reviewers
djasper
alexfh
Summary

Some of the checkers need to know what language options are enabled in order to behave sensibly. For instance, the modernize-use-nullptr checker should not suggest use of nullptr when the file being checked is a C file, not a C++ file.

This patch exposes the language options to checkers, and corrects the bug with modernize-use-nullptr by only registering the matcher if C++11 language features are enabled.

~Aaron

Diff Detail

Event Timeline

aaron.ballman retitled this revision from to [PATCH] Expose AST language options to checkers.
aaron.ballman updated this object.
aaron.ballman added reviewers: alexfh, djasper.
aaron.ballman added a subscriber: cfe-commits.
alexfh accepted this revision.Aug 27 2015, 2:17 PM
alexfh edited edge metadata.

Looks good .Thanks for fixing this!

BTW, there are other checks that use LangOpts in the check() method. IIRC, misc-use-override, google-readabiity-casting and maybe something else. We need to fix those as well.

This revision is now accepted and ready to land.Aug 27 2015, 2:17 PM
aaron.ballman closed this revision.Aug 27 2015, 2:19 PM

Thanks! I've commit in r246209.

I plan to do a more thorough search of clang-tidy to see what else can make use of this feature, this just happened to be low-hanging fruit that I found today by accident.

~Aaron