summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/Checkers.td
Commit message (Collapse)AuthorAgeFilesLines
* [analyzer] Move Checkers.inc to clang/include/...Chih-Hung Hsieh2016-04-281-651/+0
| | | | | | | | Simplify sharing of Checkers.inc with other files like ClangTidy.cpp. Differential Revision: http://reviews.llvm.org/19393 llvm-svn: 267832
* [analyzer] Move ObjCSuperDeallocChecker out of the alpha package.Devin Coughlin2016-03-021-4/+4
| | | | | | | | It will now be on by default on Darwin. rdar://problem/6953275 llvm-svn: 262526
* [analyzer] Move ObjCDeallocChecker out of the alpha package.Devin Coughlin2016-03-021-4/+4
| | | | | | | | It will now be on by default on Darwin. rdar://problem/6927496 llvm-svn: 262524
* [analyzer] Detect duplicate [super dealloc] callsDevin Coughlin2016-02-221-0/+4
| | | | | | | | | | | | | | Add an alpha path checker that warns about duplicate calls to [super dealloc]. This will form the foundation of a checker that will detect uses of 'self' after calling [super dealloc]. Part of rdar://problem/6953275. Based on a patch by David Kilzer! Differential Revision: http://reviews.llvm.org/D5238 llvm-svn: 261545
* [PATCH] Adding checker to detect excess padding in recordsBen Craig2015-12-141-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The intent of this checker is to generate a report for any class / structure that could reduce its padding by reordering the fields. This results in a very noisy checker. To reduce the noise, this checker will currently only warn when the number of bytes over "optimal" is more than 24. This value is configurable with -analyzer-config performance.Padding:AllowedPad=N. Small values of AllowedPad have the potential to generate hundreds of reports, and gigabytes of HTML reports. The checker searches for padding violations in two main ways. First, it goes record by record. A report is generated if the fields could be reordered in a way that reduces the padding by more than AllowedPad bytes. Second, the checker will generate a report if an array will cause more than AllowedPad padding bytes to be generated. The record checker currently skips many ABI specific cases. Classes with base classes are skipped because base class tail padding is ABI specific. Bitfields are just plain hard, and duplicating that code seems like a bad idea. VLAs are both uncommon and non-trivial to fix. The array checker isn't very thorough right now. It only checks to see if the element type's fields could be reordered, and it doesn't recursively check to see if any of the fields' fields could be reordered. At some point in the future, it would be nice if "arrays" could also look at array new usages and malloc patterns that appear to be creating arrays. llvm-svn: 255545
* [analyzer] Add VforkChecker to find unsafe code in vforked process.Yury Gribov2015-11-061-0/+4
| | | | | | | | | | | | This checker looks for unsafe constructs in vforked process: function calls (excluding whitelist), memory write and returns. This was originally motivated by a vfork-related bug in xtables package. Patch by Yury Gribov. Differential revision: http://reviews.llvm.org/D14014 llvm-svn: 252285
* [analyzer] Add 'optin' checker package and move localizability checkers into it.Devin Coughlin2015-11-041-12/+43
| | | | | | | | | | | | | | | | | | | | | | This commit creates a new 'optin' top-level checker package and moves several of the localizability checkers into it. This package is for checkers that are not alpha and that would normally be on by default but where the driver does not have enough information to determine when they are applicable. The localizability checkers fit this criterion because the driver cannot determine whether a project is localized or not -- this is best determined at the IDE or build-system level. This new package is *not* intended for checkers that are too noisy to be on by default. The hierarchy under 'optin' mirrors that in 'alpha': checkers under 'optin' should be organized in the hierarchy they would have had if they were truly top level (e.g., optin.osx.cocoa.MyOptInChecker). Differential Revision: http://reviews.llvm.org/D14303 llvm-svn: 252080
* [analyzer] Move the ObjCGenericsChecker out of the alpha package.Devin Coughlin2015-11-031-4/+4
| | | | | | | It is now in the osx.cocoa package and so will be on by default for Apple toolchains. llvm-svn: 251966
* [analyzer] Bug identificationGabor Horvath2015-10-221-0/+4
| | | | | | | | | | | | | | | | This patch adds hashes to the plist and html output to be able to identfy bugs for suppressing false positives or diff results against a baseline. This hash aims to be resilient for code evolution and is usable to identify bugs in two different snapshots of the same software. One missing piece however is a permanent unique identifier of the checker that produces the warning. Once that issue is resolved, the hashes generated are going to change. Until that point this feature is marked experimental, but it is suitable for early adoption. Differential Revision: http://reviews.llvm.org/D10305 Original patch by: Bence Babati! llvm-svn: 251011
* [analyzer] Improve localizability checks for iOS / OS X.Devin Coughlin2015-09-231-0/+4
| | | | | | | | | | | | | | | | | | | | Various improvements to the localization checker: * Adjusted copy to be consistent with diagnostic text in other Apple API checkers. * Added in ~150 UIKit / AppKit methods that require localized strings in UnlocalizedStringsChecker. * UnlocalizedStringChecker now checks for UI methods up the class hierarchy and UI methods that conform for a certain Objective-C protocol. * Added in alpha version of PluralMisuseChecker and some regression tests. False positives are still not ideal. (This is the second attempt, with the memory issues on Linux resolved.) A patch by Kulpreet Chilana! Differential Revision: http://reviews.llvm.org/D12417 llvm-svn: 248432
* Revert "[analyzer] Improve localizability checks for iOS / OS X."Devin Coughlin2015-09-231-4/+0
| | | | | | This reverts commit r248350. The pluralization checks are failing on some bots. llvm-svn: 248351
* [analyzer] Improve localizability checks for iOS / OS X.Devin Coughlin2015-09-221-0/+4
| | | | | | | | | | | | | | | | | | Various improvements to the localization checker: * Adjusted copy to be consistent with diagnostic text in other Apple API checkers. * Added in ~150 UIKit / AppKit methods that require localized strings in UnlocalizedStringsChecker. * UnlocalizedStringChecker now checks for UI methods up the class hierarchy and UI methods that conform for a certain Objective-C protocol. * Added in alpha version of PluralMisuseChecker and some regression tests. False positives are still not ideal. A patch by Kulpreet Chilana! Differential Revision: http://reviews.llvm.org/D12417 llvm-svn: 248350
* [Static Analyzer] General type checker based on dynamic type information.Gabor Horvath2015-09-181-0/+4
| | | | | | Differential Revision: http://reviews.llvm.org/D12973 llvm-svn: 248041
* [Static Analyzer] Moving nullability checkers out of alpha.Gabor Horvath2015-09-141-2/+2
| | | | llvm-svn: 247595
* [Static Analyzer] Moving nullability checkers to a top level package.Gabor Horvath2015-09-141-2/+2
| | | | | | Differential Revision: http://reviews.llvm.org/D12852 llvm-svn: 247590
* [Static Analyzer] Merge the Objective-C Generics Checker into Dynamic Type ↵Gabor Horvath2015-09-131-1/+1
| | | | | | | | Propagation checker. Differential Revision: http://reviews.llvm.org/D12381 llvm-svn: 247532
* [Static Analyzer] Objective-C Generics Checker improvements.Gabor Horvath2015-09-081-1/+1
| | | | | | Differential Revision: http://reviews.llvm.org/D12701 llvm-svn: 247071
* [analyzer] Apply whitespace cleanups by Honggyu Kim.Ted Kremenek2015-09-081-10/+10
| | | | llvm-svn: 246978
* [Static Analyzer] Checks to catch nullability related issues.Gabor Horvath2015-08-261-0/+25
| | | | | | Differential Revision: http://reviews.llvm.org/D11468 llvm-svn: 246105
* [Static Analyzer] Add checker to catch lightweight generics related type ↵Gabor Horvath2015-08-211-0/+4
| | | | | | | | errors in Objective-C. Differential Revision: http://reviews.llvm.org/D11427 llvm-svn: 245646
* [analyzer] Add checkers for OS X / iOS localizability issuesAnna Zaks2015-08-141-0/+8
| | | | | | | | | | | | | | | Add checkers that detect code-level localizability issues for OS X / iOS: - A path sensitive checker that warns about uses of non-localized NSStrings passed to UI methods expecting localized strings. - A syntax checker that warns against not including a comment in NSLocalizedString macros. A patch by Kulpreet Chilana! (This is the second attempt with the compilation issue on Windows and the random test failures resolved.) llvm-svn: 245093
* Revert "[analyzer] Add checkers for OS X / iOS localizability issues"Anna Zaks2015-08-081-8/+0
| | | | | | | | This reverts commit fc885033a30b6e30ccf82398ae7c30e646727b10. Revert all localization checker commits until the proper fix is implemented. llvm-svn: 244394
* [analyzer] Add checkers for OS X / iOS localizability issuesAnna Zaks2015-08-081-0/+8
| | | | | | | | | | | | Add checkers that detect code-level localizability issues for OS X / iOS: - A path sensitive checker that warns about uses of non-localized NSStrings passed to UI methods expecting localized strings. - A syntax checker that warns against not including a comment in NSLocalizedString macros. A patch by Kulpreet Chilana! llvm-svn: 244389
* [analyzer] Individual configuration options can be specified for checkers.Gabor Horvath2015-03-041-5/+1
| | | | | | | | | | Reviewed by: Anna Zaks Original patch by: Aleksei Sidorin Differential Revision: http://reviews.llvm.org/D7905 llvm-svn: 231266
* [analyzer] Move the NewDeleteLeaks checker from CplusplusAlpha to Cplusplus ↵Anton Yartsev2014-10-211-4/+4
| | | | | | package. llvm-svn: 220289
* [analyzer] Check for code testing a variable for 0 after using it as a ↵Jordan Rose2014-07-101-0/+4
| | | | | | | | | | | | | | | | | | | denominator. This new checker, alpha.core.TestAfterDivZero, catches issues like this: int sum = ... int avg = sum / count; // potential division by zero... if (count == 0) { ... } // ...caught here Because the analyzer does not necessarily explore /all/ paths through a program, this check is restricted to only work on zero checks that immediately follow a division operation (/ % /= %=). This could later be expanded to handle checks dominated by a division operation but not necessarily in the same CFG block. Patch by Anders Rönnholm! (with very minor modifications by me) llvm-svn: 212731
* [analyzer] Warn when passing pointers to const but uninitialized memory.Jordan Rose2014-03-131-0/+4
| | | | | | | | | | | | | | | | | Passing a pointer to an uninitialized memory buffer is normally okay, but if the function is declared to take a pointer-to-const then it's very unlikely it will be modifying the buffer. In this case the analyzer should warn that there will likely be a read of uninitialized memory. This doesn't check all elements of an array, only the first one. It also doesn't yet check Objective-C methods, only C functions and C++ methods. This is controlled by a new check: alpha.core.CallAndMessageUnInitRefArg. Patch by Per Viberg! llvm-svn: 203822
* [analyzer] Move checker alpha.osx.cocoa.MissingSuperCall out of alpha category.Ted Kremenek2014-02-191-4/+4
| | | | llvm-svn: 201640
* [analyzer] Remove IdempotentOperations checker.Ted Kremenek2014-01-041-4/+0
| | | | | | | | | This checker has not been updated to work with interprocedural analysis, and actually contains both logical correctness issues but also memory bugs. We can resuscitate it from version control once there is focused interest in making it a real viable checker again. llvm-svn: 198476
* [analyzer] Add IdenticalExprChecker, to find copy-pasted code.Jordan Rose2013-11-081-0/+4
| | | | | | | | | | | | | This syntactic checker looks for expressions on both sides of comparison operators that are structurally the same. As a special case, the floating-point idiom "x != x" for "isnan(x)" is left alone. Currently this only checks comparison operators, but in the future we could extend this to include logical operators or chained if-conditionals. Checker by Per Viberg! llvm-svn: 194236
* [analyzer] Add a debug checker that prints Exploded GraphAnna Zaks2013-06-241-0/+4
| | | | | | | | | | | Add a debug checker that is useful to understand how the ExplodedGraph is built; it can be triggered using the following command: clang -cc1 -analyze -analyzer-checker=debug.ViewExplodedGraph my_program.c A patch by Béatrice Creusillet! llvm-svn: 184768
* [analyzer] Re-enable cplusplus.NewDelete (but not NewDeleteLeaks).Jordan Rose2013-04-051-4/+5
| | | | | | | | As mentioned in the previous commit message, the use-after-free and double-free warnings for 'delete' are worth enabling even while the leak warnings still have false positives. llvm-svn: 178891
* [analyzer] Split new/delete checker into use-after-free and leaks parts.Jordan Rose2013-04-051-1/+5
| | | | | | | | | | | | This splits the leak-checking part of alpha.cplusplus.NewDelete into a separate user-level checker, alpha.cplusplus.NewDeleteLeaks. All the difficult false positives we've seen with the new/delete checker have been spurious leak warnings; the use-after-free warnings and mismatched deallocator warnings, while rare, have always been valid. <rdar://problem/6194569> llvm-svn: 178890
* [analyzer] Rename “Mac OS X API”, “Mac OS API” -> “API Misuse ↵Anna Zaks2013-04-031-1/+1
| | | | | | | | (Apple)” As they are relevant on both Mac and iOS. llvm-svn: 178687
* [analyzer] Moving cplusplus.NewDelete to alpha.* for now.Anton Yartsev2013-04-021-5/+4
| | | | llvm-svn: 178529
* [analyzer] These implements unix.MismatchedDeallocatorChecker checker.Anton Yartsev2013-03-281-1/+4
| | | | | | | | + Improved display names for allocators and deallocators The checker checks if a deallocation function matches allocation one. ('free' for 'malloc', 'delete' for 'new' etc.) llvm-svn: 178250
* [analyzer] Adds cplusplus.NewDelete checker that check for memory leaks, ↵Anton Yartsev2013-03-251-2/+10
| | | | | | double free, and use-after-free problems of memory managed by new/delete. llvm-svn: 177849
* [analyzer] Rename AttrNonNullChecker -> NonNullParamCheckerAnna Zaks2013-03-091-3/+3
| | | | llvm-svn: 176755
* [analyzer] Split IvarInvalidation into two checkersAnna Zaks2013-02-081-1/+5
| | | | | | | Separate the checking for the missing invalidation methods into a separate checker so that it can be turned on/off independently. llvm-svn: 174781
* [analyzer] Fix a false positive in Secure Keychain API checker.Anna Zaks2013-01-071-1/+1
| | | | | | | | | Better handle the blacklisting of known bad deallocators when symbol escapes through a call to CFStringCreateWithBytesNoCopy. Addresses radar://12702952. llvm-svn: 171770
* Fix typo: objc_no_direct_instance_variable_assignmemt => ↵Ted Kremenek2012-12-221-1/+1
| | | | | | | | objc_no_direct_instance_variable_assignment. Fixes <rdar://problem/12927551>. llvm-svn: 170971
* [analyzer] Implement an opt-in variant of direct ivar assignment.Anna Zaks2012-12-051-1/+5
| | | | | | | This will only check the direct ivar assignments in the annotated methods. llvm-svn: 169349
* [analyzer] Check that the argument to CFMakeCollectable is non-NULL.Jordan Rose2012-11-071-1/+1
| | | | | | Patch by Sean McBride! llvm-svn: 167537
* [analyzer] New checker for missing super calls in UIViewController subclasses.Jordan Rose2012-10-301-0/+4
| | | | | | | | | | | | This is a syntactic checker aimed at helping iOS programmers correctly subclass and override the methods of UIViewController. While this should eventually be covered by the 'objc_requires_super' attribute, this checker can be used with the existing iOS SDKs without any header changes. This new checker is currently named 'alpha.osx.cocoa.MissingSuperCall'. Patch by Julian Mayer! llvm-svn: 166993
* [analyzer] Add SimpleStreamChecker.Anna Zaks2012-10-291-0/+4
| | | | | | This is an example checker for catching fopen fclose API misuses. llvm-svn: 166976
* Remove OSAtomicChecker.Ted Kremenek2012-10-111-5/+0
| | | | llvm-svn: 165744
* Add checker debug.ConfigDumper to dump the contents of the configuration table.Ted Kremenek2012-10-011-0/+4
| | | | | | | The format of this output is a WIP; largely I'm bringing it up now for regression testing. We can evolve the output format over time. llvm-svn: 164953
* [analyzer] Add an experimental ObjC direct ivar assignment checker.Anna Zaks2012-09-271-0/+4
| | | | llvm-svn: 164790
* [analyzer] Address Jordan's code review comments for r164716.Anna Zaks2012-09-271-1/+1
| | | | llvm-svn: 164788
* [analyzer] Add experimental ObjC invalidation method checker.Anna Zaks2012-09-261-7/+11
| | | | | | | | | | | This checker is annotation driven. It checks that the annotated invalidation method accesses all ivars of the enclosing objects that are objects of type, which in turn contains an invalidation method. This is driven by __attribute((annotation("objc_instance_variable_invalidator")). llvm-svn: 164716
OpenPOWER on IntegriCloud