Index: www/analyzer/available_checks.html
===================================================================
--- www/analyzer/available_checks.html
+++ www/analyzer/available_checks.html
@@ -38,11 +38,13 @@
Core Checkers model core language features and perform general-purpose checks such as division by zero, null pointer dereference, usage of uninitialized values, etc.
C++ Checkers perform C++-specific checks
Dead Code Checkers check for unused code
+LLVM Checkers for LLVM developers
Nullability Checkers
Optin Checkers
OS X Checkers perform Objective-C-specific checks and check the use of Apple's SDKs (OS X and iOS)
Security Checkers check for insecure API usage and perform checks based on the CERT Secure Coding Standards
Unix Checkers check the use of Unix and POSIX APIs
+Variable Argument Checkers
@@ -369,6 +371,25 @@
Name, Description | Example |
+
+
+
+cplusplus.InnerPointer
+(C++)
+Check for inner pointers of C++ containers used after re/deallocation.
+ |
+
+
+void log(const char *str);
+
+void test(int value) {
+ const char *msg = std::to_string(value).c_str();
+ // msg points to the buffer of a temporary that is now destroyed
+ log(msg); // warn: inner pointer of container used after re/deallocation
+}
+ |
+
+
cplusplus.NewDelete
(C++)
@@ -435,6 +456,7 @@
} // warn
|
+
@@ -458,6 +480,25 @@
+
+LLVM Checkers
+
+
+Name, Description | Example |
+
+
+
+llvm.Conventions
+(C)
+Check code for LLVM codebase conventions. |
+ |
+
+
+
+
Nullability Checkers
@@ -535,6 +576,21 @@
}
+
+
+nullability.NullableReturnedFromNonnull
+(ObjC)
+Warns when a nullable pointer is returned from a function that has _Nonnull return type. |
+
+
+typedef struct Dummy { int val; } Dummy;
+
+Dummy *_Nonnull test(Dummy *_Nullable a) {
+ Dummy *p = a;
+ return p; // warn
+}
+ |
+
@@ -610,6 +666,62 @@
[alarmStateLabel setText:alarmText];
+
+
+optin.performance.GCDAntipattern
+(ObjC)
+Check for performance anti-patterns when using Grand Central Dispatch.
+ |
+
+
+void use_semaphor_antipattern() {
+ dispatch_semaphore_t sema = dispatch_semaphore_create(0);
+
+ func(^{
+ dispatch_semaphore_signal(sema);
+ });
+ dispatch_semaphore_wait(sema, 100); // warn: waiting on a callback using a
+ // semaphore
+}
+ |
+
+
+
+optin.performance.Padding
+(C)
+Check for excessively padded structs.
+ |
+
+
+class PaddedA { // warn: excessive padding
+ char c1;
+ int i;
+ char c2;
+};
+ |
+
+
+
+optin.portability.UnixAPI
+(C)
+Finds implementation-defined behavior in UNIX/Posix functions.
+
+calloc
+malloc
+realloc
+reallocf
+alloca, __builtin_alloca
+__builtin_alloca_with_align
+valloc
+ |
+
+
+void *f(int n) {
+ return malloc(n * 0 * sizeof(int)); // warn: Call to 'malloc' has an
+ // allocation size of 0 bytes
+}
+ |
+
@@ -649,6 +761,16 @@
+
+osx.ObjCProperty
+(ObjC)
+Check for proper uses of Objective-C properties |
+ |
+
+
osx.SecKeychainAPI
(C)
@@ -732,7 +854,8 @@
osx.cocoa.AtSync
(ObjC)
-Check for nil pointers used as mutexes for @synchronized . |
+Check for nil pointers used as mutexes for @synchronized .
+
void test(id x) {
@@ -748,6 +871,17 @@
|
+
+osx.cocoa.AutoreleaseWrite
+(ObjC)
+Warn about potentially crashing writes to autoreleasing objects from different
+autoreleasing pools in Objective-C. |
+ |
+
+
osx.cocoa.ClassRelease
(ObjC)
@@ -931,6 +1065,17 @@
|
+
+osx.cocoa.NonNilReturnValue
+(ObjC)
+Model the APIs that are guaranteed to return a non-nil value. |
+ |
+
+
+
osx.cocoa.ObjCGenerics
(ObjC)
@@ -964,6 +1109,17 @@
|
+
+osx.cocoa.RunLoopAutoreleaseLeak
+(ObjC)
+Check for leaked memory in autorelease pools that will never be drained.
+ |
+ |
+
+
osx.cocoa.SelfInit
(ObjC)
@@ -1571,6 +1727,74 @@
+
+
+ Variable Argument Checkers
+
+
+Name, Description | Example |
+
+
+
+valist.CopyToSelf
+(C)
+Calls to the va_copy macro should not copy onto itself. |
+
+
+#include <stdarg.h>
+
+void test(int x, ...) {
+ va_list args;
+ va_start(args, x);
+ va_copy(args, args); // warn
+ va_end(args);
+}
+ |
+
+
+valist.Uninitialized
+(C)
+Calls to the va_arg , va_copy , or
+va_end macro must happen after calling va_start and
+before calling va_end . |
+
+
+#include <stdarg.h>
+
+void test(int x, ...) {
+ va_list args;
+ int y = va_arg(args, int); // warn
+}
+
+
+#include <stdarg.h>
+
+void test(int x, ...) {
+ va_list args;
+ va_start(args, x);
+ va_end(args);
+ int z = va_arg(args, int); // warn
+}
+ |
+
+
+valist.Unterminated
+(C)
+Every va_start must be matched by a va_end . A va_list
+can only be ended once. |
+
+
+#include <stdarg.h>
+
+void test(int x, ...) {
+ va_list args;
+ va_start(args, x);
+ int y = x + va_arg(args, int);
+} // warn: missing va_end
+ |
+
+
+
| |