summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2015-08-28 13:20:46 +0000
committerAaron Ballman <aaron@aaronballman.com>2015-08-28 13:20:46 +0000
commitf36a425eba7ecea9a0c9d0cc9c7c6b43ac9bbb31 (patch)
tree7d35c72413b33c16de2eb450dc28d63eb3472f2a /clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
parentc20fee5dc57a66bea6dee24068ca3c4fe8a6ecec (diff)
downloadbcm5719-llvm-f36a425eba7ecea9a0c9d0cc9c7c6b43ac9bbb31.tar.gz
bcm5719-llvm-f36a425eba7ecea9a0c9d0cc9c7c6b43ac9bbb31.zip
Reapplying r246209, which exposed language options to the checkers. This time disable UseNullptrCheck when not compiling in C++ mode, but still allow in C++11 mode since it's likely the user wishes to modernize their code.
llvm-svn: 246298
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
index ea3bd95013f..08d6c9827b9 100644
--- a/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
+++ b/clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
@@ -453,7 +453,11 @@ void UseNullptrCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
}
void UseNullptrCheck::registerMatchers(MatchFinder *Finder) {
- Finder->addMatcher(makeCastSequenceMatcher(), this);
+ // Only register the matcher for C++. Because this checker is used for
+ // modernization, it is reasonable to run it on any C++ standard with the
+ // assumption the user is trying to modernize their codebase.
+ if (getLangOpts().CPlusPlus)
+ Finder->addMatcher(makeCastSequenceMatcher(), this);
}
void UseNullptrCheck::check(const MatchFinder::MatchResult &Result) {
OpenPOWER on IntegriCloud