commit | 611d2e4ee6a5150b45659abafd76e5917d4382a7 | [log] [tgz] |
---|---|---|
author | Aaron Ballman <aaron@aaronballman.com> | Fri Feb 19 14:03:20 2016 +0000 |
committer | Aaron Ballman <aaron@aaronballman.com> | Fri Feb 19 14:03:20 2016 +0000 |
tree | 3872485262322b245a83bc1c270fba2f39c1b786 | |
parent | 7ca8a826f407e4d408e503afa14df9b7f147ba11 [diff] [blame] |
Add a new check, cert-flp30-c, that diagnoses loop induction expressions of floating-point type. This check corresponds to the CERT secure coding rule: https://www.securecoding.cert.org/confluence/display/c/FLP30-C.+Do+not+use+floating-point+variables+as+loop+counters llvm-svn: 261324
diff --git a/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp b/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp index 4e0a6ed..05a631b 100644 --- a/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp +++ b/clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
@@ -16,6 +16,7 @@ #include "../misc/NonCopyableObjects.h" #include "../misc/StaticAssertCheck.h" #include "../misc/ThrowByValueCatchByReferenceCheck.h" +#include "FloatLoopCounter.h" #include "SetLongJmpCheck.h" #include "StaticObjectExceptionCheck.h" #include "ThrownExceptionTypeCheck.h" @@ -53,7 +54,9 @@ // DCL CheckFactories.registerCheck<StaticAssertCheck>( "cert-dcl03-c"); - + // FLP + CheckFactories.registerCheck<FloatLoopCounter>( + "cert-flp30-c"); // FIO CheckFactories.registerCheck<NonCopyableObjectsCheck>( "cert-fio38-c");