xazax.hun created this revision.
xazax.hun added reviewers: hokein, alexfh.
xazax.hun added a subscriber: cfe-commits.
xazax.hun set the repository for this revision to rL LLVM.
xazax.hun added a project: clang-tools-extra.
Herald added a subscriber: nemanjai.
In some cases do not register the matcher when the check method of a checker
should not run anyways.
Refactor some checks to use a shorter way to get language options.
Repository:
rL LLVM
https://reviews.llvm.org/D24881
Files:
clang-tidy/cert/StrToNumCheck.cpp
clang-tidy/cppcoreguidelines/ProTypeCstyleCastCheck.cpp
clang-tidy/google/AvoidCStyleCastsCheck.cpp
clang-tidy/google/ExplicitConstructorCheck.cpp
clang-tidy/llvm/TwineLocalCheck.cpp
clang-tidy/misc/AssertSideEffectCheck.cpp
clang-tidy/misc/InaccurateEraseCheck.cpp
clang-tidy/misc/InefficientAlgorithmCheck.cpp
clang-tidy/misc/StringIntegerAssignmentCheck.cpp
clang-tidy/misc/SuspiciousStringCompareCheck.cpp
clang-tidy/misc/UniqueptrResetReleaseCheck.cpp
clang-tidy/misc/UnusedAliasDeclsCheck.cpp
clang-tidy/misc/UnusedRAIICheck.cpp
clang-tidy/misc/UnusedUsingDeclsCheck.cpp
clang-tidy/modernize/PassByValueCheck.cpp
clang-tidy/modernize/RawStringLiteralCheck.cpp
clang-tidy/modernize/RedundantVoidArgCheck.cpp
clang-tidy/modernize/ShrinkToFitCheck.cpp
clang-tidy/modernize/UseOverrideCheck.cpp
clang-tidy/mpi/TypeMismatchCheck.cpp
clang-tidy/readability/AvoidConstParamsInDecls.cpp
clang-tidy/readability/ContainerSizeEmptyCheck.cpp
clang-tidy/readability/NamespaceCommentCheck.cpp
clang-tidy/readability/RedundantControlFlowCheck.cpp
clang-tidy/readability/RedundantSmartptrGetCheck.cpp
clang-tidy/readability/SimplifyBooleanExprCheck.cpp
clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp
clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
Index: clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
===
--- clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
+++ clang-tidy/readability/UniqueptrDeleteReleaseCheck.cpp
@@ -53,7 +53,7 @@
SourceLocation AfterPtr =
Lexer::getLocForEndOfToken(PtrExpr->getLocEnd(), 0, *Result.SourceManager,
- Result.Context->getLangOpts());
+ getLangOpts());
diag(DeleteExpr->getLocStart(),
"prefer '= nullptr' to 'delete x.release()' to reset unique_ptr<> "
Index: clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp
===
--- clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp
+++ clang-tidy/readability/StaticDefinitionInAnonymousNamespaceCheck.cpp
@@ -54,11 +54,11 @@
SourceLocation Loc = Def->getSourceRange().getBegin();
while (Loc < Def->getSourceRange().getEnd() &&
!Lexer::getRawToken(Loc, Tok, *Result.SourceManager,
- Result.Context->getLangOpts(), true)) {
+ getLangOpts(), true)) {
SourceRange TokenRange(Tok.getLocation(), Tok.getEndLoc());
StringRef SourceText = Lexer::getSourceText(
CharSourceRange::getTokenRange(TokenRange),
-*Result.SourceManager, Result.Context->getLangOpts());
+*Result.SourceManager, getLangOpts());
if (SourceText == "static") {
Diag << FixItHint::CreateRemoval(TokenRange);
break;
Index: clang-tidy/readability/SimplifyBooleanExprCheck.cpp
===
--- clang-tidy/readability/SimplifyBooleanExprCheck.cpp
+++ clang-tidy/readability/SimplifyBooleanExprCheck.cpp
@@ -561,7 +561,7 @@
StringRef Replacement) {
CharSourceRange CharRange = Lexer::makeFileCharRange(
CharSourceRange::getTokenRange(ReplacementRange), *Result.SourceManager,
- Result.Context->getLangOpts());
+ getLangOpts());
DiagnosticBuilder Diag = diag(Loc, Description);
if (!containsDiscardedTokens(Result, CharRange))
Index: clang-tidy/readability/RedundantSmartptrGetCheck.cpp
===
--- clang-tidy/readability/RedundantSmartptrGetCheck.cpp
+++ clang-tidy/readability/RedundantSmartptrGetCheck.cpp
@@ -119,7 +119,7 @@
StringRef SmartptrText = Lexer::getSourceText(
CharSourceRange::getTokenRange(Smartptr->getSourceRange()),
- *Result.SourceManager, Result.Context->getLangOpts());
+ *Result.SourceManager, getLangOpts());
// Replace foo->get() with *foo, and foo.get() with foo.
std::string Replacement = Twine(IsPtrToPtr ? "*" : "", SmartptrText).str();
diag(GetCall->getLocStart(), "redundant get() call on smart pointer")
Index: clang-tidy/readability/RedundantControlFlowCheck.cpp
===
--- clang-tidy/readability/RedundantControlFlowCheck.cpp
+++ clang-tidy/readability/RedundantControlFlowCheck.cpp
@@ -81,14