summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Highlight sink nodes in redGeorge Karpenkov2018-09-211-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D52337 llvm-svn: 342769
* [analyzer] Associate diagnostics created in checkEndFunction with a return ↵George Karpenkov2018-09-213-10/+26
| | | | | | | | | | 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] Fix bug in isInevitablySinkingGeorge Karpenkov2018-09-211-8/+7
| | | | | | | | | | | | If the non-sink report is generated at the exit node, it will be suppressed by the current functionality in isInevitablySinking, as it only checks the successors of the block, but not the block itself. The bug shows up in RetainCountChecker checks. Differential Revision: https://reviews.llvm.org/D52284 llvm-svn: 342766
* [analyzer] [NFC] Dead code removalGeorge Karpenkov2018-09-212-16/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D52269 llvm-svn: 342765
* [analyzer] ExplodedGraph printing fixesGeorge Karpenkov2018-09-172-44/+24
| | | | | | | | | | | | | Fixes a number of issues: - Global variables are not used for communication - Trait should be defined on a graph, not on a node - Defining the trait on a graph allows us to use a correct allocator, no longer crashing while printing trimmed graphs Differential Revision: https://reviews.llvm.org/D52183 llvm-svn: 342413
* [analyzer] Further printing improvements: use declarations,George Karpenkov2018-09-154-14/+15
| | | | | | | | skip pointers whenever redundant, use unique prefixes. Differential Revision: https://reviews.llvm.org/D52114 llvm-svn: 342316
* [analyzer] Generate and use stable identifiers for LocationContextGeorge Karpenkov2018-09-151-2/+2
| | | | | | | | | | Those are not created in the allocator. Since they are created fairly rarely, a counter overhead should not affect the memory consumption. Differential Revision: https://reviews.llvm.org/D51827 llvm-svn: 342314
* [analyzer] Dump reproducible identifiers for statements in exploded graph in ↵George Karpenkov2018-09-153-12/+17
| | | | | | | | store Differential Revision: https://reviews.llvm.org/D51826 llvm-svn: 342313
* [analyzer] Use correct end-of-line character when printing statements for ↵George Karpenkov2018-09-151-4/+7
| | | | | | | | | | exploded graph Prevents bad centering. Differential Revision: https://reviews.llvm.org/D51825 llvm-svn: 342312
* [analyzer] Dump unique identifiers for statements in exploded graphGeorge Karpenkov2018-09-151-18/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D51823 llvm-svn: 342310
* [analyzer] Skip printing duplicate nodes, even if nodes have multiple ↵George Karpenkov2018-09-151-1/+6
| | | | | | | | | | predecessors/successors Still generate a node, but leave the redundant field empty. Differential Revision: https://reviews.llvm.org/D51821 llvm-svn: 342308
* [analyzer] [NFC] Move methods for dumping the coverage in HTMLDiagnostics ↵George Karpenkov2018-09-071-5/+12
| | | | | | | | into the class Differential Revision: https://reviews.llvm.org/D51513 llvm-svn: 341724
* [analyzer] [NFC] Use StringRef when returning a large string literal in ↵George Karpenkov2018-09-071-5/+6
| | | | | | | | | | HTMLDiagnostics (NB: could be a clang-tidy / analyzer check) Differential Revision: https://reviews.llvm.org/D51512 llvm-svn: 341723
* [analyzer] Remove the "postponed" hack, deal with derived symbols using an ↵George Karpenkov2018-09-071-22/+40
| | | | | | | | | | | | | | | | | | | | extra map The "derived" symbols indicate children fields of a larger symbol. As parents do not have pointers to their children, the garbage collection algorithm the analyzer currently uses adds such symbols into a "postponed" category, and then keeps running through the worklist until the fixed point is reached. The current patch rectifies that by instead using a helper map which stores pointers from parents to children, so that no fixed point calculation is necessary. The current patch yields ~5% improvement in running time on sqlite. Differential Revision: https://reviews.llvm.org/D51397 llvm-svn: 341722
* Revert "Revert "Revert "Revert "[analyzer] Add coverage information to plist ↵George Karpenkov2018-09-071-8/+42
| | | | | | | | | | 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-071-42/+8
| | | | | | | | 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-071-8/+42
| | | | | | | | | | 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-071-42/+8
| | | | | | | | 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-071-8/+42
| | | | | | | | Split tests which were still using FileCheck to compare plists. Differential Revision: https://reviews.llvm.org/D51515 llvm-svn: 341621
* [analyzer] [NFC] Prefer passing around reference to std::unique_ptr&George Karpenkov2018-09-071-9/+9
| | | | | | | | When object is owned elsewhere Differential Revision: https://reviews.llvm.org/D51669 llvm-svn: 341620
* [analyzer] Executed lines: store file IDs, not hashes.George Karpenkov2018-09-072-4/+4
| | | | | | | | Raw FileIDs are needed for the PlistDiagnostics to produce stable filenames. Differential Revision: https://reviews.llvm.org/D51668 llvm-svn: 341619
* [analyzer] Do not add invalid source location to the coverage informationGeorge Karpenkov2018-09-071-0/+5
| | | | | | | | Invalid source locations may arise from generated code. Differential Revision: https://reviews.llvm.org/D51761 llvm-svn: 341618
* [analyzer] Push updating-the-executed-lines logic into the BugReporter.George Karpenkov2018-09-072-16/+17
| | | | | | | | So it can be reused across different consumers. Differential Revision: https://reviews.llvm.org/D51514 llvm-svn: 341617
* [analyzer] Skip printing trivial nodes in exploded graphGeorge Karpenkov2018-09-072-16/+41
| | | | | | | | | | | A node is considered to be trivial if it only has one successor, one predecessor, and a state equal to the predecessor. Can drastically (> 2x) reduce the size of the generated exploded graph. Differential Revision: https://reviews.llvm.org/D51665 llvm-svn: 341616
* [analyzer] [NFC] Move dumping program point into a separate functionGeorge Karpenkov2018-09-061-131/+132
| | | | | | Differential Revision: https://reviews.llvm.org/D51666 llvm-svn: 341603
* [analyzer] Dump stable identifiers for exploded nodesGeorge Karpenkov2018-09-062-3/+14
| | | | | | Differential Revision: https://reviews.llvm.org/D51667 llvm-svn: 341602
* [analyzer] Remove traces of ubigraph visualizationGeorge Karpenkov2018-09-061-20/+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] Dump a reproducible, deterministic ID of program state to ↵George Karpenkov2018-09-062-1/+9
| | | | | | | | exploded graph Differential Revision: https://reviews.llvm.org/D51395 llvm-svn: 341600
* [analyzer] Support modeling no-op BaseToDerived casts in ExprEngine.Artem Dergachev2018-08-293-11/+68
| | | | | | | | | | | | | | | 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
* [CFG] [analyzer] Disable argument construction contexts for variadic functions.Artem Dergachev2018-08-291-9/+21
| | | | | | | | | | | 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
* [analyzer] Resolve the crash in ReturnUndefCheckerGeorge Karpenkov2018-08-291-0/+1
| | | | | | | | | | | 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-292-2/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D51251 llvm-svn: 340963
* [analyzer] [NFC] Remove unused "state" argument from makeSymExprValNNGeorge Karpenkov2018-08-292-7/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D51250 llvm-svn: 340962
* [analyzer] Better retain count rules for OSObjectsGeorge Karpenkov2018-08-291-29/+27
| | | | | | Differential Revision: https://reviews.llvm.org/D51184 llvm-svn: 340961
* [analyzer] [NFC] Follow the convention when naming classesGeorge Karpenkov2018-08-291-24/+24
| | | | | | | | Renames InvalidateRegionsWorker and RemoveDeadBindingsWorker Differential Revision: https://reviews.llvm.org/D51324 llvm-svn: 340960
* [analyzer] Moved all CSA code from the SMT API to a new header, `SMTConv.h`. ↵Mikhail R. Gadelha2018-08-232-18/+14
| | | | | | | | | | | | | | | | | | | | | NFC. Summary: With this patch, the SMT backend is almost completely detached from the CSA. Unfortunate consequence is that we missed the `ConditionTruthVal` from the CSA and had to use `Optional<bool>`. The Z3 solver implementation is still in the same file as the `Z3ConstraintManager`, in `lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp` though, but except for that, the SMT API can be moved to anywhere in the codebase. Reviewers: NoQ, george.karpenkov Reviewed By: george.karpenkov Subscribers: xazax.hun, szepet, a.sidorin, Szelethus Differential Revision: https://reviews.llvm.org/D50772 llvm-svn: 340534
* [analyzer] Templatefy SMTConstraintManager so more generic code can be moved ↵Mikhail R. Gadelha2018-08-233-240/+1
| | | | | | | | | | | | | | | | | | | from solver specific implementations. NFC. Summary: By making SMTConstraintManager a template and passing the SMT constraint type and expr, we can further move code from the Z3ConstraintManager class to the generic SMT constraint Manager. Now, each SMT specific constraint manager only needs to implement the method `bool canReasonAbout(SVal X) const`. Reviewers: NoQ, george.karpenkov Reviewed By: george.karpenkov Subscribers: mgorny, xazax.hun, szepet, a.sidorin, Szelethus Differential Revision: https://reviews.llvm.org/D50770 llvm-svn: 340533
* [analyzer] Delete SMTContext. NFC.Mikhail R. Gadelha2018-08-231-3/+2
| | | | | | | | | | | | | | Summary: There is no reason to have a base class for a context anymore as each SMT object carries a reference to the specific solver context. Reviewers: NoQ, george.karpenkov, hiraditya Reviewed By: hiraditya Subscribers: hiraditya, xazax.hun, szepet, a.sidorin, Szelethus Differential Revision: https://reviews.llvm.org/D50768 llvm-svn: 340532
* Change dyn_cast<CXXMethodDecl>(FD) to isa<CXXMethodDecl>(FD) [NFC]Mikael Holmen2018-08-231-1/+1
| | | | | | The result of the dyn_cast wasn't used to we can just check isa. llvm-svn: 340531
* Removed unused variable [NFC]Mikael Holmen2018-08-231-1/+1
| | | | | | | | | | The compiler warned: ../tools/clang/lib/StaticAnalyzer/Core/RetainSummaryManager.cpp:329:19: error: unused variable 'MD' [-Werror,-Wunused-variable] if (const auto *MD = dyn_cast<CXXMethodDecl>(FD)) { ^ 1 error generated. llvm-svn: 340524
* [analyzer] Preliminary version of retain count checking for OSObjectsGeorge Karpenkov2018-08-231-2/+85
| | | | | | | | Has quite a lot of false positives, disabled behind the flag. Differential Revision: https://reviews.llvm.org/D50880 llvm-svn: 340502
* [analyzer] Track non-zero values in ReturnVisitorGeorge Karpenkov2018-08-221-24/+27
| | | | | | | | | | | | | Tracking those can help to provide much better diagnostics in many cases. In general, most of the visitor machinery should be refactored to allow tracking the origin of arbitrary values. rdar://36039765 Differential Revision: https://reviews.llvm.org/D51131 llvm-svn: 340475
* [analyzer] [NFC] Minor refactoring of BugReporterVisitorsGeorge Karpenkov2018-08-221-15/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D51130 llvm-svn: 340473
* [analyzer] Improve `CallDescription` to handle c++ method.Henry Wong2018-08-221-1/+28
| | | | | | | | | | | | | | | | | Summary: `CallDecription` can only handle function for the time being. If we want to match c++ method, we can only use method name to match and can't improve the matching accuracy through the qualifiers. This patch add the support for `QualifiedName` matching to improve the matching accuracy. Reviewers: xazax.hun, NoQ, george.karpenkov, rnkovacs Reviewed By: xazax.hun, NoQ, rnkovacs Subscribers: Szelethus, szepet, rnkovacs, a.sidorin, mikhail.ramalho, cfe-commits, MTC Differential Revision: https://reviews.llvm.org/D48027 llvm-svn: 340407
* [analyzer] [NFC] Split up RetainSummaryManager from RetainCountChecker - try #2George Karpenkov2018-08-212-0/+903
| | | | | | | | | | Turns out it can't be removed from the analyzer since it relies on CallEvent. Moving to staticAnalyzer/core Differential Revision: https://reviews.llvm.org/D51023 llvm-svn: 340247
* Model type attributes as regular Attrs.Richard Smith2018-08-201-2/+2
| | | | | | | | | | | | | | Specifically, AttributedType now tracks a regular attr::Kind rather than having its own parallel Kind enumeration, and AttributedTypeLoc now holds an Attr* instead of holding an ad-hoc collection of Attr fields. Differential Revision: https://reviews.llvm.org/D50526 This reinstates r339623, reverted in r339638, with a fix to not fail template instantiation if we instantiate a QualType with no associated type source information and we encounter an AttributedType. llvm-svn: 340215
* Silence "unused variable" warning.Richard Smith2018-08-151-0/+1
| | | | llvm-svn: 339747
* [analyzer] Add support for constructors of arguments.Artem Dergachev2018-08-155-29/+216
| | | | | | | | | | | | | | | | | | | | | Once CFG-side support for argument construction contexts landed in r338436, the analyzer could make use of them to evaluate argument constructors properly. When evaluated as calls, constructors of arguments now use the variable region of the parameter as their target. The corresponding stack frame does not yet exist when the parameter is constructed, and this stack frame is created eagerly. Construction of functions whose body is unavailable and of virtual functions is not yet supported. Part of the reason is the analyzer doesn't consistently use canonical declarations o identify the function in these cases, and every re-declaration or potential override comes with its own set of parameter declarations. Also it is less important because if the function is not inlined, there's usually no benefit in inlining the argument constructor. Differential Revision: https://reviews.llvm.org/D49443 llvm-svn: 339745
* Revert r339623 "Model type attributes as regular Attrs."Reid Kleckner2018-08-141-2/+2
| | | | | | | | This breaks compiling atlwin.h in Chromium. I'm sure the code is invalid in some way, but we put a lot of work into accepting it, and I'm sure rejecting it was not an intended consequence of this refactoring. :) llvm-svn: 339638
* Model type attributes as regular Attrs.Richard Smith2018-08-131-2/+2
| | | | | | | | | | Specifically, AttributedType now tracks a regular attr::Kind rather than having its own parallel Kind enumeration, and AttributedTypeLoc now holds an Attr* instead of holding an ad-hoc collection of Attr fields. Differential Revision: https://reviews.llvm.org/D50526 llvm-svn: 339623
OpenPOWER on IntegriCloud