summaryrefslogtreecommitdiffstats
path: root/test/Analysis/Inputs
Commit message (Collapse)AuthorAgeFilesLines
* [analyzer][tests][NFC] Add EOF newlines, normalize reference expected filesHubert Tong2019-05-013-2/+3
| | | | | | | | | | | | Reference expected files not ending with a newline are normalized to have said newlines. Additionally `plist-macros-with-expansion.cpp.plist` is modified to add a line that is ignored by `%diff_plist`, but not by the more sensitive pattern proposed by http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html for `%normalize_plist`. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359692 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer][CrossTU] Extend CTU to VarDecls with initializerRafael Stahl2019-04-232-0/+48
| | | | | | | | | | | | | | | | | | | | | | Summary: The existing CTU mechanism imports `FunctionDecl`s where the definition is available in another TU. This patch extends that to VarDecls, to bind more constants. - Add VarDecl importing functionality to CrossTranslationUnitContext - Import Decls while traversing them in AnalysisConsumer - Add VarDecls to CTU external mappings generator - Name changes from "external function map" to "external definition map" Reviewers: NoQ, dcoughlin, xazax.hun, george.karpenkov, martong Reviewed By: xazax.hun Subscribers: Charusso, baloghadamsoftware, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, george.karpenkov, mgorny, whisperity, szepet, rnkovacs, a.sidorin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D46421 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358968 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] PR41269: Add a bit of C++ smart pointer modeling.Artem Dergachev2019-04-231-0/+1
| | | | | | | | | | | | | | Implement cplusplus.SmartPtrModeling, a new checker that doesn't emit any warnings but models methods of smart pointers more precisely. For now the only thing it does is make `(bool) P` return false when `P` is a freshly moved pointer. This addresses a false positive in the use-after-move-checker. Differential Revision: https://reviews.llvm.org/D60796 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358944 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] NoStoreFuncVisitor: Suppress reports with no-store in system headers.Artem Dergachev2019-04-051-0/+17
| | | | | | | | | | | | | | | | | | The idea behind this heuristic is that normally the visitor is there to inform the user that a certain function may fail to initialize a certain out-parameter. For system header functions this is usually dictated by the contract, and it's unlikely that the header function has accidentally forgot to put the value into the out-parameter; it's more likely that the user has intentionally skipped the error check. Warnings on skipped error checks are more like security warnings; they aren't necessarily useful for all users, and they should instead be introduced on a per-API basis. Differential Revision: https://reviews.llvm.org/D60107 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@357810 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Fix function macro crashKristof Umann2019-03-141-0/+478
| | | | | | | | | Re-commit D57893. Differential Revision: https://reviews.llvm.org/D57893 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@356142 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[analyzer] Fix function macro crash"Kristof Umann2019-03-121-478/+0
| | | | | | | | | | | Buildbot breaks when LLVm is compiled with memory sanitizer. WARNING: MemorySanitizer: use-of-uninitialized-value #0 0xa3d16d8 in getMacroNameAndPrintExpansion(blahblah) lib/StaticAnalyzer/Core/PlistDiagnostics.cpp:903:11 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355911 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Fix function macro crashKristof Umann2019-03-121-0/+478
| | | | | | | | | | | | | | | | | | | | When there is a functor-like macro which is passed as parameter to another "function" macro then its parameters are not listed at the place of expansion: #define foo(x) int bar() { return x; } #define hello(fvar) fvar(0) hello(foo) int main() { 1 / bar(); } Expansion of hello(foo) asserted Clang, because it expected an l_paren token in the 3rd line after "foo", since it is a function-like token. Patch by Tibor Brunner! Differential Revision: https://reviews.llvm.org/D57893 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355903 91177308-0d34-0410-b5e6-96231b3b80d8
* [Analyzer] Checker for non-determinism caused by sorting of pointer-like ↵Mandeep Singh Grang2019-03-081-0/+23
| | | | | | | | | | | | | | | | | | | | elements Summary: Added a new category of checkers for non-determinism. Added a checker for non-determinism caused due to sorting containers with pointer-like elements. Reviewers: NoQ, george.karpenkov, whisperity, Szelethus Reviewed By: NoQ, Szelethus Subscribers: Charusso, baloghadamsoftware, jdoerfert, donat.nagy, dkrupp, martong, dblaikie, MTC, Szelethus, mgorny, xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D50488 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355720 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Fix infinite recursion in printing macrosKristof Umann2019-03-081-0/+134
| | | | | | | | | | | | | | | | | | | | | | In the commited testfile, macro expansion (the one implemented for the plist output) runs into an infinite recursion. The issue originates from the algorithm being faulty, as in #define value REC_MACRO_FUNC(value) the "value" is being (or at least attempted) expanded from the same macro. The solved this issue by gathering already visited macros in a set, which does resolve the crash, but will result in an incorrect macro expansion, that would preferably be fixed down the line. Patch by Tibor Brunner! Differential Revision: https://reviews.llvm.org/D57891 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@355705 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] [RetainCountChecker] Bugfix for tracking top-level parameters of ↵George Karpenkov2019-01-302-4306/+4310
| | | | | | | | Objective-C methods Differential Revision: https://reviews.llvm.org/D57433 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352588 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] [RetainCountChecker] Track input parameters to the top-level functionGeorge Karpenkov2019-01-292-6452/+6452
| | | | | | | | | | Track them for ISL/OS objects by default, and for NS/CF under a flag. rdar://47536377 Differential Revision: https://reviews.llvm.org/D57356 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352534 91177308-0d34-0410-b5e6-96231b3b80d8
* [ASTImporter] Fix handling of overriden methods during ASTImportShafik Yaghmour2019-01-281-13/+18
| | | | | | | | | Summary: When importing classes we may add a CXXMethodDecl more than once to a CXXRecordDecl when handling overrides. This patch will fix the cases we currently know about and handle the case where we are only dealing with declarations. Differential Revision: https://reviews.llvm.org/D56936 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352436 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Reimplement dependencies between checkersKristof Umann2019-01-269-516/+500
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, up until now, the fact that certain checkers depended on one another was known, but how these actually unfolded was hidden deep within the implementation. For example, many checkers (like RetainCount, Malloc or CString) modelled a certain functionality, and exposed certain reportable bug types to the user. For example, while MallocChecker models many many different types of memory handling, the actual "unix.MallocChecker" checker the user was exposed to was merely and option to this modeling part. Other than this being an ugly mess, this issue made resolving the checker naming issue almost impossible. (The checker naming issue being that if a checker registered more than one checker within its registry function, both checker object recieved the same name) Also, if the user explicitly disabled a checker that was a dependency of another that _was_ explicitly enabled, it implicitly, without "telling" the user, reenabled it. Clearly, changing this to a well structured, declarative form, where the handling of dependencies are done on a higher level is very much preferred. This patch, among the detailed things later, makes checkers declare their dependencies within the TableGen file Checkers.td, and exposes the same functionality to plugins and statically linked non-generated checkers through CheckerRegistry::addDependency. CheckerRegistry now resolves these dependencies, makes sure that checkers are added to CheckerManager in the correct order, and makes sure that if a dependency is disabled, so will be every checker that depends on it. In detail: * Add a new field to the Checker class in CheckerBase.td called Dependencies, which is a list of Checkers. * Move unix checkers before cplusplus, as there is no forward declaration in tblgen :/ * Add the following new checkers: - StackAddrEscapeBase - StackAddrEscapeBase - CStringModeling - DynamicMemoryModeling (base of the MallocChecker family) - IteratorModeling (base of the IteratorChecker family) - ValistBase - SecuritySyntaxChecker (base of bcmp, bcopy, etc...) - NSOrCFErrorDerefChecker (base of NSErrorChecker and CFErrorChecker) - IvarInvalidationModeling (base of IvarInvalidation checker family) - RetainCountBase (base of RetainCount and OSObjectRetainCount) * Clear up and registry functions in MallocChecker, happily remove old FIXMEs. * Add a new addDependency function to CheckerRegistry. * Neatly format RUN lines in files I looked at while debugging. Big thanks to Artem Degrachev for all the guidance through this project! Differential Revision: https://reviews.llvm.org/D54438 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352287 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Split unix.API up to UnixAPIMisuseChecker and ↵Kristof Umann2019-01-261-18/+18
| | | | | | | | | | | | | | | | | UnixAPIPortabilityChecker The actual implementation of unix.API features a dual-checker: two checkers in one, even though they don't even interact at all. Split them up, as this is a problem for establishing dependencies. I added no new code at all, just merely moved it around. Since the plist files change (and that's a benefit!) this patch isn't NFC. Differential Revision: https://reviews.llvm.org/D55425 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@352278 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Support for OSObjects out parameters in RetainCountCheckerGeorge Karpenkov2019-01-112-8/+8
| | | | | | | | | rdar://46357478 rdar://47121327 Differential Revision: https://reviews.llvm.org/D56240 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350982 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] [NFC] Fix the FIXME in testsGeorge Karpenkov2019-01-112-0/+52295
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350946 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Update the category name for RetainCountChecker reportsGeorge Karpenkov2019-01-106-40/+40
| | | | | | | | | | ..now that it includes OSObjects rdar://46509986 Differential Revision: https://reviews.llvm.org/D56404 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350869 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Quote the type of the leaked/problematic object in diagnostics ↵George Karpenkov2019-01-105-1190/+1224
| | | | | | | | for readability Differential Revision: https://reviews.llvm.org/D56344 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350867 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer][CrossTU][NFC] Generalize to external definitions instead of ↵Rafael Stahl2019-01-102-0/+0
| | | | | | | | | | | | | | | | external functions Summary: This is just changing naming and documentation to be general about external definitions that can be imported for cross translation unit analysis. There is at least a plan to add VarDecls: D46421 Reviewers: NoQ, xazax.hun, martong, a.sidorin, george.karpenkov, serge-sans-paille Reviewed By: xazax.hun, martong Subscribers: mgorny, whisperity, baloghadamsoftware, szepet, rnkovacs, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D56441 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@350852 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert rC349281 '[analyzer][MallocChecker][NFC] Document and reorganize some ↵Kristof Umann2018-12-171-10/+10
| | | | | | functions' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349340 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer][MallocChecker] Improve warning messages on double-delete errorsKristof Umann2018-12-151-10/+10
| | | | | | | Differential Revision: https://reviews.llvm.org/D54834 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349283 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] MoveChecker Pt.6: Suppress the warning for the move-safe STL classes.Artem Dergachev2018-12-141-0/+23
| | | | | | | | | | | | Some C++ standard library classes provide additional guarantees about their state after move. Suppress warnings on such classes until a more precise behavior is implemented. Warnings for locals are not suppressed anyway because it's still most likely a bug. Differential Revision: https://reviews.llvm.org/D55307 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@349191 91177308-0d34-0410-b5e6-96231b3b80d8
* [CTU] Add more lit tests and better error handlingGabor Marton2018-12-073-0/+55
| | | | | | | | | | | | | | | Summary: Adding some more CTU list tests. E.g. to check if a construct is unsupported. We also slightly modify the handling of the return value of the `Import` function from ASTImporter. Reviewers: xazax.hun, balazske, a_sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits Differential Revision: https://reviews.llvm.org/D55131 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348605 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer][PlistMacroExpansion] Part 5.: Support for # and ##Kristof Umann2018-11-301-64/+402
| | | | | | | | | | From what I can see, this should be the last patch needed to replicate macro argument expansions. Differential Revision: https://reviews.llvm.org/D52988 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@348025 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Add the type of the leaked object to the diagnostic messageGeorge Karpenkov2018-11-302-6/+6
| | | | | | | | | | | | If the object is a temporary, and there is no variable it binds to, let's at least print out the object name in order to help differentiate it from other temporaries. rdar://45175098 Differential Revision: https://reviews.llvm.org/D55033 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347943 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Reference leaked object by name, even if it was created in an ↵George Karpenkov2018-11-301-3/+3
| | | | | | | | | | inlined function. rdar://45532181 Differential Revision: https://reviews.llvm.org/D54973 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347942 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer][PlistMacroExpansion] Part 4.: Support for __VA_ARGS__Kristof Umann2018-11-291-82/+251
| | | | | | | Differential Revision: https://reviews.llvm.org/D52986 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347888 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer][PlistMacroExpansion] Part 3.: Macro arguments are expandedKristof Umann2018-11-271-80/+3637
| | | | | | | | | This part focuses on expanding macro arguments. Differential Revision: https://reviews.llvm.org/D52795 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347629 91177308-0d34-0410-b5e6-96231b3b80d8
* Reland '[analyzer][PlistMacroExpansion] Part 2.: Retrieving the macro name ↵Kristof Umann2018-11-051-5/+1042
| | | | | | and primitive expansion' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346111 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert '[analyzer][PlistMacroExpansion] Part 2.: Retrieving the macro name ↵Kristof Umann2018-11-041-1042/+5
| | | | | | and primitive expansion' git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346096 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer][PlistMacroExpansion] Part 2.: Retrieving the macro name and ↵Kristof Umann2018-11-041-5/+1042
| | | | | | | | | | | | primitive expansion This patch adds a couple new functions to acquire the macro's name, and also expands it, although it doesn't expand the arguments, as seen from the test files Differential Revision: https://reviews.llvm.org/D52794 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346095 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Put llvm.Conventions back in alphaKristof Umann2018-11-021-0/+43
| | | | | | | | | | | | | Interestingly, this many year old (when I last looked I remember 2010ish) checker was committed without any tests, so I thought I'd implement them, but I was shocked to see how I barely managed to get it working. The code is severely outdated, I'm not even sure it has ever been used, so I'd propose to move it back into alpha, and possibly even remove it. Differential Revision: https://reviews.llvm.org/D53856 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345990 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer][PlistMacroExpansion] Part 1.: New expand-macros flagKristof Umann2018-10-311-0/+351
| | | | | | | | | | | | | | | This is the first part of the implementation of the inclusion of macro expansions into the plist output. It adds a new flag that adds a new "macro_expansions" entry to each report that has PathDiagnosticPieces that were expanded from a macro. While there's an entry for each macro expansion, both the name of the macro and what it expands to is missing, and will be implemented in followup patches. Differential Revision: https://reviews.llvm.org/D52742 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@345724 91177308-0d34-0410-b5e6-96231b3b80d8
* [cxx2a] P0614R1: Support init-statements in range-based for loops.Richard Smith2018-09-281-0/+281
| | | | | | | We don't yet support this for the case where a range-based for loop is implicitly rewritten to an ObjC for..in statement. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@343350 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Process state in checkEndFunction in RetainCountCheckerGeorge Karpenkov2018-09-211-247/+1
| | | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@342770 91177308-0d34-0410-b5e6-96231b3b80d8
* [Analyzer] Iterator Checker - Part 8: Support for assign, clear, insert, ↵Adam Balogh2018-09-101-0/+61
| | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341794 91177308-0d34-0410-b5e6-96231b3b80d8
* [Analyzer] Iterator Checker - Part 7: Support for push and pop operationsAdam Balogh2018-09-101-0/+12
| | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341793 91177308-0d34-0410-b5e6-96231b3b80d8
* [Analyzer] Iterator Checker - Part 4: Mismatched iterator checker for ↵Adam Balogh2018-09-101-0/+6
| | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341790 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "Revert "Revert "[analyzer] Add coverage information to plist ↵George Karpenkov2018-09-0719-2589/+10795
| | | | | | | | | | output, update tests"""" This reverts commit 2f5d71d9fa135be86bb299e7d773036e50bf1df6. Hopefully fixing tests on Windows. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341719 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "Revert "[analyzer] Add coverage information to plist output, ↵Simon Pilgrim2018-09-0719-10795/+2589
| | | | | | | | update tests""" Reverts analyzer tests from rL341627 again as they still broke windows buildbots git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341648 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "Revert "[analyzer] Add coverage information to plist output, update ↵George Karpenkov2018-09-0719-2589/+10795
| | | | | | | | | | tests"" This reverts commit a39bcab414dd7ace7e490363ecdf01ecce7743fc. Reverting the revert, fixing tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341627 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert "[analyzer] Add coverage information to plist output, update tests"George Karpenkov2018-09-0719-10704/+2668
| | | | | | | | This reverts commit 03d183b6b94eda27ce66a4f9b87a00b0a148cf9e. Temporary revert until the tests are fixed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341626 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Add coverage information to plist output, update testsGeorge Karpenkov2018-09-0719-2668/+10704
| | | | | | | | Split tests which were still using FileCheck to compare plists. Differential Revision: https://reviews.llvm.org/D51515 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341621 91177308-0d34-0410-b5e6-96231b3b80d8
* [Analyzer] Iterator Checker - Part 3: Invalidation check, first for (copy) ↵Adam Balogh2018-08-281-3/+43
| | | | | | | | | | | | | 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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340805 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Re-instate support for MakeCollectable is RetainCountCheckerGeorge Karpenkov2018-08-171-517/+629
| | | | | | Differential Revision: https://reviews.llvm.org/D50872 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340097 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Drop support for GC mode in RetainCountCheckerGeorge Karpenkov2018-08-172-1952/+518
| | | | | | | | | | | | A lot of code in RetainCountChecker deals with GC mode. Given that GC mode is deprecated, Apple does not ship runtime for it, and modern compiler toolchain does not support it, it makes sense to remove the code dealing with it in order to aid understanding of RetainCountChecker. Differential Revision: https://reviews.llvm.org/D50747 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340091 91177308-0d34-0410-b5e6-96231b3b80d8
* Move test inputs into Inputs directory.Richard Smith2018-08-1422-0/+56972
| | | | | | | We don't need a new ExpectedOutputs/ convention. Expected outputs are just another form of test input. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339634 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Record nullability implications on getting items from NSDictionaryGeorge Karpenkov2018-08-101-0/+51
| | | | | | | | | | | | | | | | | | | | If we get an item from a dictionary, we know that the item is non-null if and only if the key is non-null. This patch is a rather hacky way to record this implication, because some logic needs to be duplicated from the solver. And yet, it's pretty simple, performant, and works. Other possible approaches: - Record the implication, in future rely on Z3 to pick it up. - Generalize the current code and move it to the constraint manager. rdar://34990742 Differential Revision: https://reviews.llvm.org/D50124 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@339482 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer] Syntactic matcher for leaks associated with run loop and ↵George Karpenkov2018-07-251-0/+4
| | | | | | | | | | | | | | | | | | | | | | | autoreleasepool A checker for detecting leaks resulting from allocating temporary autoreleasing objects before starting the main run loop. Checks for two antipatterns: 1. ObjCMessageExpr followed by [[NARunLoop mainRunLoop] run] in the same autorelease pool. 2. ObjCMessageExpr followed by [[NARunLoop mainRunLoop] run] in no autorelease pool. Happens-before relationship is modeled purely syntactically. rdar://39299145 Differential Revision: https://reviews.llvm.org/D49528 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@337876 91177308-0d34-0410-b5e6-96231b3b80d8
* [analyzer][ctu] fix unsortable diagnosticsRafael Stahl2018-07-042-0/+8
| | | | | | | | | | | | | | Summary: In the provided test case the PathDiagnostic compare function was not able to find a difference. Reviewers: xazax.hun, NoQ, dcoughlin, george.karpenkov Reviewed By: george.karpenkov Subscribers: a_sidorin, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits Differential Revision: https://reviews.llvm.org/D48474 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336275 91177308-0d34-0410-b5e6-96231b3b80d8