diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/cert')
5 files changed, 17 insertions, 30 deletions
diff --git a/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp b/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp index 71135378a29..d88825be8c8 100644 --- a/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp @@ -34,8 +34,7 @@ public: void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override { // C++ checkers // DCL - CheckFactories.registerCheck<VariadicFunctionDefCheck>( - "cert-dcl50-cpp"); + CheckFactories.registerCheck<VariadicFunctionDefCheck>("cert-dcl50-cpp"); CheckFactories.registerCheck<misc::NewDeleteOverloadsCheck>( "cert-dcl54-cpp"); CheckFactories.registerCheck<google::build::UnnamedNamespaceInHeaderCheck>( @@ -46,37 +45,27 @@ public: // ERR CheckFactories.registerCheck<misc::ThrowByValueCatchByReferenceCheck>( "cert-err09-cpp"); - CheckFactories.registerCheck<SetLongJmpCheck>( - "cert-err52-cpp"); - CheckFactories.registerCheck<StaticObjectExceptionCheck>( - "cert-err58-cpp"); - CheckFactories.registerCheck<ThrownExceptionTypeCheck>( - "cert-err60-cpp"); + CheckFactories.registerCheck<SetLongJmpCheck>("cert-err52-cpp"); + CheckFactories.registerCheck<StaticObjectExceptionCheck>("cert-err58-cpp"); + CheckFactories.registerCheck<ThrownExceptionTypeCheck>("cert-err60-cpp"); CheckFactories.registerCheck<misc::ThrowByValueCatchByReferenceCheck>( "cert-err61-cpp"); // MSC - CheckFactories.registerCheck<LimitedRandomnessCheck>( - "cert-msc50-cpp"); + CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc50-cpp"); // C checkers // DCL - CheckFactories.registerCheck<misc::StaticAssertCheck>( - "cert-dcl03-c"); + CheckFactories.registerCheck<misc::StaticAssertCheck>("cert-dcl03-c"); // ENV - CheckFactories.registerCheck<CommandProcessorCheck>( - "cert-env33-c"); + CheckFactories.registerCheck<CommandProcessorCheck>("cert-env33-c"); // FLP - CheckFactories.registerCheck<FloatLoopCounter>( - "cert-flp30-c"); + CheckFactories.registerCheck<FloatLoopCounter>("cert-flp30-c"); // FIO - CheckFactories.registerCheck<misc::NonCopyableObjectsCheck>( - "cert-fio38-c"); + CheckFactories.registerCheck<misc::NonCopyableObjectsCheck>("cert-fio38-c"); // ERR - CheckFactories.registerCheck<StrToNumCheck>( - "cert-err34-c"); + CheckFactories.registerCheck<StrToNumCheck>("cert-err34-c"); // MSC - CheckFactories.registerCheck<LimitedRandomnessCheck>( - "cert-msc30-c"); + CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc30-c"); } ClangTidyOptions getModuleOptions() override { ClangTidyOptions Options; @@ -89,8 +78,8 @@ public: // Register the MiscTidyModule using this statically initialized variable. static ClangTidyModuleRegistry::Add<cert::CERTModule> -X("cert-module", - "Adds lint checks corresponding to CERT secure coding guidelines."); + X("cert-module", + "Adds lint checks corresponding to CERT secure coding guidelines."); // This anchor is used to force the linker to link in the generated object file // and thus register the CERTModule. diff --git a/clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.cpp b/clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.cpp index 807f1835fa6..f319f9fb3a5 100644 --- a/clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.cpp +++ b/clang-tools-extra/clang-tidy/cert/LimitedRandomnessCheck.cpp @@ -30,11 +30,9 @@ void LimitedRandomnessCheck::check(const MatchFinder::MatchResult &Result) { msg = "; use C++11 random library instead"; const auto *MatchedDecl = Result.Nodes.getNodeAs<CallExpr>("randomGenerator"); - diag(MatchedDecl->getLocStart(), - "rand() has limited randomness" + msg); + diag(MatchedDecl->getLocStart(), "rand() has limited randomness" + msg); } } // namespace cert } // namespace tidy } // namespace clang - diff --git a/clang-tools-extra/clang-tidy/cert/StaticObjectExceptionCheck.cpp b/clang-tools-extra/clang-tidy/cert/StaticObjectExceptionCheck.cpp index a5d85277f2b..c465ecc5996 100644 --- a/clang-tools-extra/clang-tidy/cert/StaticObjectExceptionCheck.cpp +++ b/clang-tools-extra/clang-tidy/cert/StaticObjectExceptionCheck.cpp @@ -47,7 +47,7 @@ void StaticObjectExceptionCheck::check(const MatchFinder::MatchResult &Result) { << VD << (VD->getStorageDuration() == SD_Static ? 0 : 1); SourceLocation FuncLocation = Func->getLocation(); - if(FuncLocation.isValid()) { + if (FuncLocation.isValid()) { diag(FuncLocation, "possibly throwing %select{constructor|function}0 declared here", DiagnosticIDs::Note) diff --git a/clang-tools-extra/clang-tidy/cert/StrToNumCheck.cpp b/clang-tools-extra/clang-tidy/cert/StrToNumCheck.cpp index d698a768d2d..bd84cf2b44a 100644 --- a/clang-tools-extra/clang-tidy/cert/StrToNumCheck.cpp +++ b/clang-tools-extra/clang-tidy/cert/StrToNumCheck.cpp @@ -8,9 +8,9 @@ //===----------------------------------------------------------------------===// #include "StrToNumCheck.h" -#include "clang/Analysis/Analyses/FormatString.h" #include "clang/AST/ASTContext.h" #include "clang/ASTMatchers/ASTMatchFinder.h" +#include "clang/Analysis/Analyses/FormatString.h" #include "llvm/ADT/StringSwitch.h" #include <cassert> diff --git a/clang-tools-extra/clang-tidy/cert/ThrownExceptionTypeCheck.h b/clang-tools-extra/clang-tidy/cert/ThrownExceptionTypeCheck.h index e05539efb13..2f9d887f25a 100644 --- a/clang-tools-extra/clang-tidy/cert/ThrownExceptionTypeCheck.h +++ b/clang-tools-extra/clang-tidy/cert/ThrownExceptionTypeCheck.h @@ -23,7 +23,7 @@ namespace cert { class ThrownExceptionTypeCheck : public ClangTidyCheck { public: ThrownExceptionTypeCheck(StringRef Name, ClangTidyContext *Context) - : ClangTidyCheck(Name, Context) {} + : ClangTidyCheck(Name, Context) {} void registerMatchers(ast_matchers::MatchFinder *Finder) override; void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; |