summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Retain count checker for OSObject: recognize OSDynamicCastGeorge Karpenkov2018-10-111-1/+29
| | | | | | | | | | | For now, tresting the cast as a no-op, and disregarding the case where the output becomes null due to the type mismatch. rdar://45174557 Differential Revision: https://reviews.llvm.org/D53156 llvm-svn: 344311
* [analyzer][UninitializedObjectChecker] Reports Loc fields pointing to themselvesKristof Umann2018-10-111-6/+11
| | | | | | | | | | | I've added a new functionality, the checker is now able to detect and report fields pointing to themselves. I figured this would fit well into the checker as there's no reason for a pointer to point to itself instead of being nullptr. Differential Revision: https://reviews.llvm.org/D51305 llvm-svn: 344242
* [analyzer] Support Reinitializes attribute in MisusedMovedObject checkGabor Horvath2018-10-091-1/+11
| | | | | | Differential Revision: https://reviews.llvm.org/D52983 llvm-svn: 344017
* [analyzer] [quickfix] Temporarily disabling a failing test.George Karpenkov2018-10-041-0/+3
| | | | llvm-svn: 343747
* [analyzer] [tests] [quickfix] Make more test more resilient for non-defaut -std.Artem Dergachev2018-10-033-3/+3
| | | | | | | It is important to specify the version of the standard because tests should test the same thing regardless of the current default version of the standard. llvm-svn: 343736
* [analyzer] Do not crash if the assumption added in TrustNonNullChecker is ↵George Karpenkov2018-10-031-0/+22
| | | | | | | | | | enough to make the state unfeasible rdar://43541814 Differential Revision: https://reviews.llvm.org/D52848 llvm-svn: 343735
* [analyzer] [tests] [quickfix] Make the test more resilient for a non-defaut ↵George Karpenkov2018-10-031-1/+1
| | | | | | std configuration llvm-svn: 343715
* [analyzer] Fix crash in exploded graph dumpingGeorge Karpenkov2018-10-021-2/+2
| | | | | | | | By allocating new DeclStmt to ASTContext Differential Revision: https://reviews.llvm.org/D52756 llvm-svn: 343635
* [analyzer] Promote StdCLibraryFunctionsChecker to the apiModeling category.Artem Dergachev2018-10-024-19/+17
| | | | | | | | | | | Because all our languages are C-based, there's no reason to enable this checker only on UNIX targets. Patch by Donát Nagy! Differential Revision: https://reviews.llvm.org/D52722 llvm-svn: 343632
* [analyzer] Fix symbol discovery in nonloc::LocAsInteger values.Artem Dergachev2018-10-021-2/+1
| | | | | | | | | Doesn't do much despite sounding quite bad, but fixes an exotic test case where liveness of a nonloc::LocAsInteger array index is now evaluated correctly. Differential Revision: https://reviews.llvm.org/D52667 llvm-svn: 343631
* [analyzer] Provide an option to dump generated exploded graphs to a given file.George Karpenkov2018-09-281-0/+15
| | | | | | | | | | | Dumping graphs instead of opening them is often very useful, e.g. for transfer or converting to SVG. Basic sanity check for generated exploded graphs. Differential Revision: https://reviews.llvm.org/D52637 llvm-svn: 343352
* [cxx2a] P0614R1: Support init-statements in range-based for loops.Richard Smith2018-09-283-3/+288
| | | | | | | We don't yet support this for the case where a range-based for loop is implicitly rewritten to an ObjC for..in statement. llvm-svn: 343350
* [analyzer] Fix a crash on casting symbolic pointers to derived classes.Artem Dergachev2018-09-261-0/+30
| | | | | | | | | | | Commit r340984 causes a crash when a pointer to a completely unrelated type UnrelatedT (eg., opaque struct pattern) is being casted from base class BaseT to derived class DerivedT, which results in an ill-formed region Derived{SymRegion{$<UnrelatedT x>}, DerivedT}. Differential Revision: https://reviews.llvm.org/D52189 llvm-svn: 343051
* [analyzer] Add a testing facility for testing relationships between symbols.Artem Dergachev2018-09-252-521/+593
| | | | | | | | | | | | | | | | | | Tests introduced in r329780 was disabled in r342317 because these tests were accidentally testing dump infrastructure, when all they cared about was how symbols relate to each other. So when dump infrastructure changed, tests became annoying to maintain. Add a new feature to ExprInspection: clang_analyzer_denote() and clang_analyzer_explain(). The former adds a notation to a symbol, the latter expresses another symbol in terms of previously denoted symbols. It's currently a bit wonky - doesn't print parentheses and only supports denoting atomic symbols. But it's even more readable that way. Differential Revision: https://reviews.llvm.org/D52133 llvm-svn: 343048
* [analyzer] Prevent crashes in FindLastStoreBRVisitorGeorge Karpenkov2018-09-241-0/+17
| | | | | | | | | | This patch is a band-aid. A proper solution would be too change trackNullOrUndefValue to only try to dereference the pointer when it is relevant to the problem. Differential Revision: https://reviews.llvm.org/D52435 llvm-svn: 342920
* [CStringSyntaxChecker] Check strlcat sizeof checkDavid Carlier2018-09-231-3/+22
| | | | | | | | | | | | | Assuming strlcat is used with strlcpy we check as we can if the last argument does not equal os not larger than the buffer. Advising the proper usual pattern. Reviewers: george.karpenkov, NoQ, MaskRay Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D49722 llvm-svn: 342832
* [analyzer] Process state in checkEndFunction in RetainCountCheckerGeorge Karpenkov2018-09-213-255/+8
| | | | | | | | | | | | | | Modify the RetainCountChecker to perform state "adjustments" in checkEndFunction, as performing work in PreStmt<ReturnStmt> does not work with destructors. The previous version made an implicit assumption that no code runs after the return statement is executed. rdar://43945028 Differential Revision: https://reviews.llvm.org/D52338 llvm-svn: 342770
* [analyzer] Associate diagnostics created in checkEndFunction with a return ↵George Karpenkov2018-09-212-4/+5
| | | | | | | | | | statement, if possible If not possible, use the last line of the declaration, as before. Differential Revision: https://reviews.llvm.org/D52326 llvm-svn: 342768
* [Analyzer] Define and use diff_plist in tests, NFCMikhail Maltsev2018-09-1730-29/+34
| | | | | | | | | This patch defines a new substitution and uses it to reduce duplication in the Clang Analyzer test cases. Differential Revision: https://reviews.llvm.org/D52036 llvm-svn: 342365
* [analyzer] Temporary disabling svalbuilder-rearrange-comparisons testGeorge Karpenkov2018-09-151-0/+3
| | | | | | | | As debug printing has changed, and format was not guaranteed to be stable. Artem is currently working on a better solution. llvm-svn: 342317
* [analyzer] Attempt to make a windows buildbot happy.Kristof Umann2018-09-141-1/+1
| | | | | | | Got an error that a cast is happening from a pointer type to long, which is smaller. llvm-svn: 342223
* [analyzer][UninitializedObjectChecker] Support for nonloc::LocAsIntegerKristof Umann2018-09-141-0/+18
| | | | | | Differential Revision: https://reviews.llvm.org/D49437 llvm-svn: 342221
* [analyzer][UninitializedObjectChecker] New flag to ignore records based on ↵Kristof Umann2018-09-141-0/+136
| | | | | | | | | | | | | | | | | it's fields Based on a suggestion from @george.karpenkov. In some cases, structs are used as unions with a help of a tag/kind field. This patch adds a new string flag (a pattern), that is matched against the fields of a record, and should a match be found, the entire record is ignored. For more info refer to http://lists.llvm.org/pipermail/cfe-dev/2018-August/058906.html and to the responses to that, especially http://lists.llvm.org/pipermail/cfe-dev/2018-August/059215.html. Differential Revision: https://reviews.llvm.org/D51680 llvm-svn: 342220
* [analyzer][UninitializedObjectChecker] Correct dynamic type is acquired for ↵Kristof Umann2018-09-141-11/+43
| | | | | | | | record pointees Differential Revision: https://reviews.llvm.org/D50892 llvm-svn: 342217
* [analyzer][UninitializedObjectChecker] Fixed dereferencingKristof Umann2018-09-143-14/+121
| | | | | | | | | | iThis patch aims to fix derefencing, which has been debated for months now. Instead of working with SVals, the function now relies on TypedValueRegion. Differential Revision: https://reviews.llvm.org/D51057 llvm-svn: 342213
* [analyzer] [NFC] Change the tests by making the version check more resilientGeorge Karpenkov2018-09-1134-34/+34
| | | | llvm-svn: 341978
* [Analyzer] Commit fix for rL341790/rC341790Adam Balogh2018-09-101-0/+175
| | | | | | Test file was accidentally not added for rL341790/rC341790 and subsequant patches. llvm-svn: 341795
* [Analyzer] Iterator Checker - Part 8: Support for assign, clear, insert, ↵Adam Balogh2018-09-103-1/+262
| | | | | | | | | | emplace and erase operations This patch adds support for the following operations in the iterator checkers: assign, clear, insert, insert_after, emplace, emplace_after, erase and erase_after. This affects mismatched iterator checks ("this" and parameter must match) and invalidation checks (according to the standard). Differential Revision: https://reviews.llvm.org/D32904 llvm-svn: 341794
* [Analyzer] Iterator Checker - Part 7: Support for push and pop operationsAdam Balogh2018-09-104-1/+238
| | | | | | | | This patch adds support for the following operations in the iterator checkers: push_back, push_front, emplace_back, emplace_front, pop_back and pop_front. This affects iterator range checks (range is extended after push and emplace and reduced after pop operations) and invalidation checks (according to the standard). Differential Revision: https://reviews.llvm.org/D32902 llvm-svn: 341793
* [Analyzer] Iterator Checker - Part 4: Mismatched iterator checker for ↵Adam Balogh2018-09-102-2/+8
| | | | | | | | | | function parameters New check added to the checker which checks whether iterator parameters of template functions typed by the same template parameter refer to the same container. Differential Revision: https://reviews.llvm.org/D32845 llvm-svn: 341790
* Revert "Revert "Revert "Revert "[analyzer] Add coverage information to plist ↵George Karpenkov2018-09-0770-13006/+14058
| | | | | | | | | | output, update tests"""" This reverts commit 2f5d71d9fa135be86bb299e7d773036e50bf1df6. Hopefully fixing tests on Windows. llvm-svn: 341719
* Revert "Revert "Revert "[analyzer] Add coverage information to plist output, ↵Simon Pilgrim2018-09-0770-14058/+13006
| | | | | | | | update tests""" Reverts analyzer tests from rL341627 again as they still broke windows buildbots llvm-svn: 341648
* Revert "Revert "[analyzer] Add coverage information to plist output, update ↵George Karpenkov2018-09-0770-13006/+14058
| | | | | | | | | | tests"" This reverts commit a39bcab414dd7ace7e490363ecdf01ecce7743fc. Reverting the revert, fixing tests. llvm-svn: 341627
* Revert "[analyzer] Add coverage information to plist output, update tests"George Karpenkov2018-09-0743-13875/+13113
| | | | | | | | This reverts commit 03d183b6b94eda27ce66a4f9b87a00b0a148cf9e. Temporary revert until the tests are fixed. llvm-svn: 341626
* [analyzer] Add coverage information to plist output, update testsGeorge Karpenkov2018-09-0743-13113/+13875
| | | | | | | | Split tests which were still using FileCheck to compare plists. Differential Revision: https://reviews.llvm.org/D51515 llvm-svn: 341621
* [analyzer] Do not add invalid source location to the coverage informationGeorge Karpenkov2018-09-071-0/+25
| | | | | | | | Invalid source locations may arise from generated code. Differential Revision: https://reviews.llvm.org/D51761 llvm-svn: 341618
* [analyzer] Remove traces of ubigraph visualizationGeorge Karpenkov2018-09-061-7/+0
| | | | | | | | | | Ubigraph project has been dead since about 2008, and to the best of my knowledge, no one was using it. Previously, I wasn't able to launch the existing binary at all. Differential Revision: https://reviews.llvm.org/D51655 llvm-svn: 341601
* [analyzer] InnerPointerChecker: Fix a segfault when checking symbolic strings.Artem Dergachev2018-08-301-0/+4
| | | | | | | | | | Return value of dyn_cast_or_null should be checked before use. Otherwise we may put a null pointer into the map as a key and eventually crash in checkDeadSymbols. Differential Revision: https://reviews.llvm.org/D51385 llvm-svn: 341092
* [analyzer] Improve tracing for uninitialized struct fieldsGeorge Karpenkov2018-08-294-118/+209
| | | | | | | | rdar://13729267 Differential Revision: https://reviews.llvm.org/D51323 llvm-svn: 340986
* [analyzer] Support modeling no-op BaseToDerived casts in ExprEngine.Artem Dergachev2018-08-291-1/+32
| | | | | | | | | | | | | | | Introduce a new MemRegion sub-class, CXXDerivedObjectRegion, which is the opposite of CXXBaseObjectRegion, to represent such casts. Such region is a bit weird because it is by design bigger than its super-region. But it's not harmful when it is put on top of a SymbolicRegion that has unknown extent anyway. Offset computation for CXXDerivedObjectRegion and proper modeling of casts still remains to be implemented. Differential Revision: https://reviews.llvm.org/D51191 llvm-svn: 340984
* [analyzer] CFRetainReleaseChecker: Don't check C++ methods with the same name.Artem Dergachev2018-08-291-0/+15
| | | | | | | | | | | Don't try to understand what's going on when there's a C++ method called eg. CFRetain(). Refactor the checker a bit, to use more modern APIs. Differential Revision: https://reviews.llvm.org/D50866 llvm-svn: 340982
* [CFG] [analyzer] Disable argument construction contexts for variadic functions.Artem Dergachev2018-08-291-0/+20
| | | | | | | | | | | The analyzer doesn't make use of them anyway and they seem to have pretty weird AST from time to time, so let's just skip them for now. Fixes a crash reported as pr37769. Differential Revision: https://reviews.llvm.org/D50855 llvm-svn: 340977
* [CFG] [analyzer] Disable argument construction contexts for variadic functions.Artem Dergachev2018-08-291-0/+15
| | | | | | | | | | | The analyzer doesn't make use of them anyway and they seem to have pretty weird AST from time to time, so let's just skip them for now. Fixes pr37769. Differential Revision: https://reviews.llvm.org/D50824 llvm-svn: 340975
* [analyzer] Fix tests on 32-bit platforms by specifying the tuple explicitlyGeorge Karpenkov2018-08-291-5/+9
| | | | llvm-svn: 340972
* [analyzer] Resolve the crash in ReturnUndefCheckerGeorge Karpenkov2018-08-291-2/+23
| | | | | | | | | | | By making sure the returned value from getKnownSVal is consistent with the value used inside expression engine. PR38427 Differential Revision: https://reviews.llvm.org/D51252 llvm-svn: 340965
* [analyzer] Move analyzer-eagerly-assume to AnalyzerOptions, enable by defaultGeorge Karpenkov2018-08-2970-126/+128
| | | | | | Differential Revision: https://reviews.llvm.org/D51251 llvm-svn: 340963
* [Analyzer] Iterator Checker - Part 3: Invalidation check, first for (copy) ↵Adam Balogh2018-08-283-4/+76
| | | | | | | | | | | assignments We add check for invalidation of iterators. The only operation we handle here is the (copy) assignment. Differential Revision: https://reviews.llvm.org/D32747 llvm-svn: 340805
* [analyzer] Preliminary version of retain count checking for OSObjectsGeorge Karpenkov2018-08-231-0/+105
| | | | | | | | Has quite a lot of false positives, disabled behind the flag. Differential Revision: https://reviews.llvm.org/D50880 llvm-svn: 340502
* Revert "[CStringSyntaxChecker] Check strlcat sizeof check"George Karpenkov2018-08-231-17/+0
| | | | | | | | This reverts commit 3073790e87378fea9a68fb052185fec9596ef135. The check is not correct, strlact(dest, "mystr", sizeof(dest)) is fine. llvm-svn: 340501
* Revert "[CStringSyntaxChecker] Reduces space around error message for strlcat."George Karpenkov2018-08-231-1/+1
| | | | | | This reverts commit 6b43b80320722da41ca6ef7a3b57cc300fb83094. llvm-svn: 340500
OpenPOWER on IntegriCloud