summaryrefslogtreecommitdiffstats
path: root/clang/docs/analyzer
Commit message (Collapse)AuthorAgeFilesLines
* [analyzer] Add PlacementNewCheckerGabor Marton2020-01-101-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This checker verifies if default placement new is provided with pointers to sufficient storage capacity. Noncompliant Code Example: #include <new> void f() { short s; long *lp = ::new (&s) long; } Based on SEI CERT rule MEM54-CPP https://wiki.sei.cmu.edu/confluence/display/cplusplus/MEM54-CPP.+Provide+placement+new+with+properly+aligned+pointe This patch does not implement checking of the alignment. Reviewers: NoQ, xazax.hun Subscribers: mgorny, whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat Tags: #clang Differential Revision: https://reviews.llvm.org/D71612
* [analyzer] Add Fuchsia Handle checkerGabor Horvath2019-12-201-0/+25
| | | | | | | The checker can diagnose handle use after releases, double releases, and handle leaks. Differential Revision: https://reviews.llvm.org/D70470
* [analyzer][docs] NFC: Extend documentation for MallocOverflow checkerBorsik Gabor2019-11-231-0/+6
| | | | | | Patch by Benics Balázs Differential Revision: https://reviews.llvm.org/D70596
* [analyzer] Add a checker option to detect nested dead storesKristof Umann2019-09-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enables the users to specify an optional flag which would warn for more dead stores. Previously it ignored if the dead store happened e.g. in an if condition. if ((X = generate())) { // dead store to X } This patch introduces the `WarnForDeadNestedAssignments` option to the checker, which is `false` by default - so this change would not affect any previous users. I have updated the code, tests and the docs as well. If I missed something, tell me. I also ran the analysis on Clang which generated 14 more reports compared to the unmodified version. All of them seemed reasonable for me. Related previous patches: rGf224820b45c6847b91071da8d7ade59f373b96f3 Reviewers: NoQ, krememek, Szelethus, baloghadamsoftware Reviewed By: Szelethus Patch by Balázs Benics! Differential Revision: https://reviews.llvm.org/D66733 llvm-svn: 370767
* [analyzer] Add docs for cplusplus.InnerPointerKristof Umann2019-08-151-2/+27
| | | | | | Differential Revision: https://reviews.llvm.org/D60281 llvm-svn: 368979
* [CrossTU] User docs: remove temporary limiation with macro expansionGabor Marton2019-08-121-9/+0
| | | | | | D65064, D64635, D64638 pathces solve the issue with macor expansion. llvm-svn: 368562
* [analyzer] Add CTU user docsGabor Marton2019-07-182-0/+207
| | | | | | | | | | | | Reviewers: dkrupp, a_sidorin, Szelethus, NoQ Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, gamesh411, Charusso, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64801 llvm-svn: 366439
* [Docs] Add standardized header links to analyzer docNathan Huckleberry2019-07-111-0/+268
| | | | | | | | | | | | | | | | | | | | | | | Summary: Header links should have some standard form so clang tidy docs can easily reference them. The form is as follows. Start with the analyzer full name including packages. Replace all periods with dashes and lowercase everything. Ex: core.CallAndMessage -> core-callandmessage Reviewers: JonasToth, aaron.ballman, NoQ, Szelethus Reviewed By: aaron.ballman, Szelethus Subscribers: nickdesaulniers, lebedev.ri, baloghadamsoftware, mgrang, a.sidorin, Szelethus, jfb, donat.nagy, dkrupp, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64543 llvm-svn: 365797
* [analyzer]Add user docs rstGabor Marton2019-07-101-0/+4
| | | | | | | | | | | | | | | | Summary: Add user documentation page. This is an empty page atm, later patches will add the specific user documentatoins. Reviewers: dkrupp Subscribers: whisperity, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, gamesh411, Charusso, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64494 llvm-svn: 365639
* [Docs] Modernize references to macOSJ. Ryan Stinnett2019-05-302-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Summary: This updates all places in documentation that refer to "Mac OS X", "OS X", etc. to instead use the modern name "macOS" when no specific version number is mentioned. If a specific version is mentioned, this attempts to use the OS name at the time of that version: * Mac OS X for 10.0 - 10.7 * OS X for 10.8 - 10.11 * macOS for 10.12 - present Reviewers: JDevlieghere Subscribers: mgorny, christof, arphaman, cfe-commits, lldb-commits, libcxx-commits, llvm-commits Tags: #clang, #lldb, #libc, #llvm Differential Revision: https://reviews.llvm.org/D62654 llvm-svn: 362113
* [Analyzer] Checker for non-determinism caused by iteration of unordered ↵Mandeep Singh Grang2019-05-241-2/+16
| | | | | | | | | | | | | | | | | | container of pointers Summary: Added a checker for non-determinism caused by iterating unordered containers like std::unordered_set containing pointer elements. Reviewers: NoQ, george.karpenkov, whisperity, Szelethus, baloghadamsoftware Reviewed By: Szelethus Subscribers: mgorny, xazax.hun, baloghadamsoftware, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, jdoerfert, Charusso, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D59279 llvm-svn: 361664
* Attempt to fix the clang-sphinx-docs bot after r358797Nico Weber2019-05-031-1/+1
| | | | llvm-svn: 359916
* [analyzer] Move UninitializedObjectChecker out of alphaKristof Umann2019-04-191-96/+104
| | | | | | | | | Moved UninitializedObjectChecker from the 'alpha.cplusplus' to the 'optin.cplusplus' package. Differential Revision: https://reviews.llvm.org/D58573 llvm-svn: 358797
* [analyzer] Fix an assertation failure for invalid sourcelocation, add a new ↵Kristof Umann2019-03-141-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | debug checker For a rather short code snippet, if debug.ReportStmts (added in this patch) was enabled, a bug reporter visitor crashed: struct h { operator int(); }; int k() { return h(); } Ultimately, this originated from PathDiagnosticLocation::createMemberLoc, as it didn't handle the case where it's MemberExpr typed parameter returned and invalid SourceLocation for MemberExpr::getMemberLoc. The solution was to find any related valid SourceLocaion, and Stmt::getBeginLoc happens to be just that. Differential Revision: https://reviews.llvm.org/D58777 llvm-svn: 356161
* [docs] Fix checkers.rst doc for PointerSorting checkerMandeep Singh Grang2019-03-081-1/+1
| | | | llvm-svn: 355726
* [Analyzer] Checker for non-determinism caused by sorting of pointer-like ↵Mandeep Singh Grang2019-03-081-0/+12
| | | | | | | | | | | | | | | | | | | | 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 llvm-svn: 355720
* Fixed header underline in docs.Alexander Kornienko2019-02-111-252/+252
| | | | | | + Removed trailing whitespace. llvm-svn: 353711
* [analyzer] New checker for detecting usages of unsafe I/O functionsKristof Umann2019-02-111-0/+11
| | | | | | | | | | | | | | | | There are certain unsafe or deprecated (since C11) buffer handling functions which should be avoided in safety critical code. They could cause buffer overflows. A new checker, 'security.insecureAPI.DeprecatedOrUnsafeBufferHandling' warns for every occurrence of such functions (unsafe or deprecated printf, scanf family, and other buffer handling functions, which now have a secure variant). Patch by Dániel Kolozsvári! Differential Revision: https://reviews.llvm.org/D35068 llvm-svn: 353698
* Fix the sphinx buildbot after D54429Kristof Umann2019-02-051-1/+1
| | | | llvm-svn: 353150
* [analyzer] Creating standard Sphinx documentationKristof Umann2019-02-0516-243/+2632
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lack of documentation has been a long standing issue in the Static Analyzer, and one of the leading reasons behind this was a lack of good documentation infrastucture. This lead serious drawbacks, such as * Not having proper release notes for years * Not being able to have a sensible auto-generated checker documentations (which lead to most of them not having any) * The HTML website that has to updated manually is a chore, and has been outdated for a long while * Many design discussions are now hidden in phabricator revisions This patch implements a new documentation infrastucture using Sphinx, like most of the other subprojects in LLVM. It transformed some pages as a proof-of- concept, with many others to follow in later patches. The eventual goal is to preserve the original website's (https://clang-analyzer.llvm.org/) frontpage, but move everything else to the new format. Some other ideas, like creating a unipage for each checker (similar to how clang-tidy works now), are also being discussed. Patch by Dániel Krupp! Differential Revision: https://reviews.llvm.org/D54429 llvm-svn: 353126
* [Documentation] Use HTTPS whenever possibleEugene Zelenko2019-01-231-1/+1
| | | | | | Differential revision: https://reviews.llvm.org/D56946 llvm-svn: 351976
* [analyzer] Fix some expressions staying live too long. Add a debug checker.Artem Dergachev2018-12-161-1/+4
| | | | | | | | | | | | | | | | | | | | | StaticAnalyzer uses the CFG-based RelaxedLiveVariables analysis in order to, in particular, figure out values of which expressions are still needed. When the expression becomes "dead", it is garbage-collected during the dead binding scan. Expressions that constitute branches/bodies of control flow statements, eg. `E1' in `if (C1) E1;' but not `E2' in `if (C2) { E2; }', were kept alive for too long. This caused false positives in MoveChecker because it relies on cleaning up loop-local variables when they go out of scope, but some of those live-for-too-long expressions were keeping a reference to those variables. Fix liveness analysis to correctly mark these expressions as dead. Add a debug checker, debug.DumpLiveStmts, in order to test expressions liveness. Differential Revision: https://reviews.llvm.org/D55566 llvm-svn: 349320
* [analyzer] Add a testing facility for testing relationships between symbols.Artem Dergachev2018-09-251-0/+17
| | | | | | | | | | | | | | | | | | 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] Fix a typo in `RegionStore.txt`.Henry Wong2018-08-081-2/+2
| | | | | | | | | | | | | | Summary: The typo of the description for default bindings can be confusing. Reviewers: NoQ, george.karpenkov Reviewed By: NoQ, george.karpenkov Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, cfe-commits, MTC Differential Revision: https://reviews.llvm.org/D50382 llvm-svn: 339244
* Fix typos in clangAlexander Kornienko2018-04-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Found via codespell -q 3 -I ../clang-whitelist.txt Where whitelist consists of: archtype cas classs checkk compres definit frome iff inteval ith lod methode nd optin ot pres statics te thru Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few files that have dubious fixes reverted.) Differential revision: https://reviews.llvm.org/D44188 llvm-svn: 329399
* [analyzer] Document the issue hash debugging facilityGabor Horvath2017-11-131-0/+13
| | | | | | Differential Revision: https://reviews.llvm.org/D39543 llvm-svn: 318030
* [analyzer] Keep track of design discusions as part of analyzer documentation.Artem Dergachev2017-09-261-0/+321
| | | | | | | | | | | | Create a directory to store discussions on potentially useful features that are not yet implemented in the analyzer. Fill it with a discussion on representing checker-specific parts of the program state for C++ object modeling, that occured in D35216. Differential Revision: https://reviews.llvm.org/D36737 llvm-svn: 314218
* [NFC] [Analyzer] Fix RST markup in documentation.George Karpenkov2017-09-141-9/+9
| | | | llvm-svn: 313219
* Bump docs version to 6.0Hans Wennborg2017-07-191-2/+2
| | | | llvm-svn: 308466
* [analyzer] Improve usability of ExprInspectionCheckerAnna Zaks2017-03-091-1/+7
| | | | | | | | | | | | | | | | Some of the magic functions take arguments of arbitrary type. However, for semantic correctness, the compiler still requires a declaration of these functions with the correct type. Since C does not have argument-type-overloaded function, this made those functions hard to use in C code. Improve this situation by allowing arbitrary suffixes in the affected magic functions' names, thus allowing the user to create different declarations for different types. A patch by Keno Fischer! Differential Revision: https://reviews.llvm.org/D30589 llvm-svn: 297325
* Update docs/conf.py versionHans Wennborg2017-01-121-3/+3
| | | | llvm-svn: 291831
* [analyzer] Minor fixes and improvements to debug.ExprInspectionArtem Dergachev2016-11-301-0/+39
| | | | | | | | | | | | | | | | | | - Fix the bug with transition handling in ExprInspectionChecker's checkDeadSymbols implementation. - Test this bug by adding a new function clang_analyzer_numTimesReached() to catch number of passes through the code, which should be handy for testing against unintended state splits. - Add two more functions should help debugging issues quickly without running the debugger or dumping exploded graphs - clang_analyzer_dump() which dump()s an SVal argument to a warning message, and clang_analyzer_printState(), which dump()s the current program state to stderr. Differential Revision: https://reviews.llvm.org/D26835 llvm-svn: 288257
* Fix a typo in the doc: overriden -> overriddenSylvestre Ledru2016-08-281-1/+1
| | | | llvm-svn: 279942
* docs/conf.py: update version to 4.0Hans Wennborg2016-07-181-2/+2
| | | | llvm-svn: 275848
* Docs: keep copyright years up-to-date.Paul Robinson2016-03-301-1/+2
| | | | llvm-svn: 264941
* Remove autoconf supportChris Bieneman2016-01-261-155/+0
| | | | | | | | | | | | | | | | | Summary: This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html "This is the way [autoconf] ends Not with a bang but a whimper." -T.S. Eliot Reviewers: chandlerc, grosbach, bob.wilson, echristo Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D16472 llvm-svn: 258862
* [analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion, v2.Artem Dergachev2016-01-151-0/+35
| | | | | | | | | | | | | | | | Provide separate visitor templates for the three hierarchies, and also the `FullSValVisitor' class, which is a union of all three visitors. Additionally, add a particular example visitor, `SValExplainer', in order to test the visitor templates. This visitor is capable of explaining the SVal, SymExpr, or MemRegion in a natural language. Compared to the reverted r257605, this fixes the test that used to fail on some triples, and fixes build failure under -fmodules. Differential Revision: http://reviews.llvm.org/D15448 llvm-svn: 257893
* Revert "[analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion."Artem Dergachev2016-01-131-35/+0
| | | | | | | | | This reverts commit r257605. The test fails on architectures that use unsigned int as size_t. SymbolManager.h fails with compile errors on some platforms. llvm-svn: 257608
* [analyzer] Provide .def-files and visitors for SVal/SymExpr/MemRegion.Artem Dergachev2016-01-131-0/+35
| | | | | | | | | | | | | Provide separate visitor templates for the three hierarchies, and also the `FullSValVisitor' class, which is a union of all three visitors. Additionally, add a particular example visitor, `SValExplainer', in order to test the visitor templates. This visitor is capable of explaining the SVal, SymExpr, or MemRegion in a natural language. Differential Revision: http://reviews.llvm.org/D15448 llvm-svn: 257605
* [analyzer] Fix symbolic element index lifetime.Artem Dergachev2015-12-101-0/+23
| | | | | | | | | | | | SymbolReaper was destroying the symbol too early when it was referenced only from an index SVal of a live ElementRegion. In order to test certain aspects of this patch, extend the debug.ExprInspection checker to allow testing SymbolReaper in a direct manner. Differential Revision: http://reviews.llvm.org/D12726 llvm-svn: 255236
* [Static Analyzer] Checks to catch nullability related issues.Gabor Horvath2015-08-261-0/+92
| | | | | | Differential Revision: http://reviews.llvm.org/D11468 llvm-svn: 246105
* Update the copyright credits -- Happy new year 2014!NAKAMURA Takumi2014-01-011-1/+1
| | | | | FIXME: Dragonegg may be updated at non-trivial changes. llvm-svn: 198274
* [analyzer] Add new debug helper clang_analyzer_warnIfReached.Jordan Rose2013-10-031-0/+13
| | | | | | | | | | | | | This will emit a warning if a call to clang_analyzer_warnIfReached is executed, printing REACHABLE. This is a more explicit way to declare expected reachability than using clang_analyzer_eval or triggering a bug (divide-by-zero or null dereference), and unlike the former will work the same in inlined functions and top-level functions. Like the other debug helpers, it is part of the debug.ExprInspection checker. Patch by Jared Grubb! llvm-svn: 191909
* [analyzer] Fix copy-paste error in internal docs.Jordan Rose2013-09-131-1/+1
| | | | | | Patch by Jared Grubb! llvm-svn: 190651
* [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
* We're in 3.4 land now.Bill Wendling2013-05-071-2/+2
| | | | llvm-svn: 181351
* [analyzer] Enable destructor inlining by default (c++-inlining=destructors).Jordan Rose2013-04-041-6/+35
| | | | | | | | | | | | | | | | | | | | | This turns on not only destructor inlining, but inlining of constructors for types with non-trivial destructors. Per r178516, we will still not inline the constructor or destructor of anything that looks like a container unless the analyzer-config option 'c++-container-inlining' is set to 'true'. In addition to the more precise path-sensitive model, this allows us to catch simple smart pointer issues: #include <memory> void test() { std::auto_ptr<int> releaser(new int[4]); } // memory allocated with 'new[]' should not be deleted with 'delete' <rdar://problem/12295363> llvm-svn: 178805
* [analyzer] Turn on C++ constructor inlining by default.Jordan Rose2013-02-271-3/+4
| | | | | | | | | | This enables constructor inlining for types with non-trivial destructors. The plan is to enable destructor inlining within the next month, but that needs further verification. <rdar://problem/12295329> llvm-svn: 176200
* [analyzer] Add a doc describing the internals of RegionStore.Jordan Rose2013-02-051-0/+171
| | | | | | | | This is a text file with Markdown-ish formatting because we haven't decided where analyzer internal documents should go, but it's probably better to have this in source control than sitting on my local drive forever. llvm-svn: 174398
* [analyzer] Remove further references to analyzer-ipa.Anna Zaks2013-01-301-34/+35
| | | | | | Thanks Jordan! llvm-svn: 173955
OpenPOWER on IntegriCloud