summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer
Commit message (Collapse)AuthorAgeFilesLines
...
* Track IntrusiveRefCntPtr::get() changes from LLVM r212366Alp Toker2014-07-057-24/+24
| | | | llvm-svn: 212369
* Remove llvm:: from uses of ArrayRef.Craig Topper2014-06-281-1/+1
| | | | llvm-svn: 211987
* Do not inline methods of C++ containers (coming from headers).Anna Zaks2014-06-272-15/+13
| | | | | | | | | | | | | | | | | | | This silences false positives (leaks, use of uninitialized value) in simple code that uses containers such as std::vector and std::list. The analyzer cannot reason about the internal invariances of those data structures which leads to false positives. Until we come up with a better solution to that problem, let's just not inline the methods of the containers and allow objects to escape whenever such methods are called. This just extends an already existing flag "c++-container-inlining" and applies the heuristic not only to constructors and destructors of the containers, but to all of their methods. We have a bunch of distinct user reports all related to this issue (radar://16058651, radar://16580751, radar://16384286, radar://16795491 [PR19637]). llvm-svn: 211832
* [OPENMP] Initial parsing and sema analysis for 'single' directive.Alexey Bataev2014-06-261-0/+1
| | | | llvm-svn: 211774
* [OPENMP] Initial parsing and sema analysis for 'section' directive.Alexey Bataev2014-06-261-0/+1
| | | | llvm-svn: 211767
* [OPENMP] Initial support for 'sections' directive.Alexey Bataev2014-06-251-0/+1
| | | | llvm-svn: 211685
* StaticAnalyzer: Switch a loop to a range-based forDavid Majnemer2014-06-231-3/+2
| | | | | | Merely a code simplification, no functionality change. llvm-svn: 211484
* [analyzer] Check for NULL passed to CFAutorelease.Jordan Rose2014-06-211-6/+11
| | | | | | Patch by Sean McBride, tests adjusted by me. llvm-svn: 211453
* [analyzer] Don't create new PostStmt nodes if we don't have to.Jordan Rose2014-06-181-1/+1
| | | | | | | | Doing this caused us to mistakenly think we'd seen a particular state before when we actually hadn't, which resulted in false negatives. Credit to Rafael Auler for discovering this issue! llvm-svn: 211209
* [OPENMP] Initial support for '#pragma omp for' (fixed incompatibility with ↵Alexey Bataev2014-06-181-0/+1
| | | | | | MSVC). llvm-svn: 211140
* Revert "[OPENMP] Initial support for '#pragma omp for'."Rafael Espindola2014-06-171-1/+0
| | | | | | | | This reverts commit r211096. Looks like it broke the msvc build: SemaOpenMP.cpp(140) : error C4519: default template arguments are only allowed on a class template llvm-svn: 211113
* [OPENMP] Initial support for '#pragma omp for'.Alexey Bataev2014-06-171-0/+1
| | | | llvm-svn: 211096
* One of our buildbot for FreeBSD does not support std::to_string.Sylvestre Ledru2014-06-141-6/+8
| | | | | | Use stringstream instead to convert int to string llvm-svn: 210972
* List the function/method name in the index page of scan-buildSylvestre Ledru2014-06-141-0/+4
| | | | llvm-svn: 210971
* With the option '-analyzer-config stable-report-filename=true',Sylvestre Ledru2014-06-142-16/+76
| | | | | | | | instead of report-XXXXXX.html, scan-build/clang analyzer generate report-<filename>-<function, method name>-<function position>-<id>.html. (id = i++ for several issues found in the same function/method) llvm-svn: 210970
* Fix a crash in Retain Count checker error reportingAnna Zaks2014-06-131-5/+18
| | | | | | | | | Fixes a crash in Retain Count checker error reporting logic by handing the allocation statement retrieval from a BlockEdge program point. Also added a simple CFG dump routine for debugging. llvm-svn: 210960
* Replace llvm::error_code with std::error_code.Rafael Espindola2014-06-121-2/+2
| | | | llvm-svn: 210780
* Removing an "if (this == nullptr)" check from two print methods. The conditionRichard Trieu2014-06-093-2/+7
| | | | | | | will never be true in a well-defined context. The checking for null pointers has been moved into the caller logic so it does not rely on undefined behavior. llvm-svn: 210498
* Don't assume an implicit IntrusiveRefCntPtr -> bool operator.Rafael Espindola2014-06-031-1/+1
| | | | llvm-svn: 210075
* Move the logic for testing for namespace std into one location. This check canRichard Trieu2014-05-283-4/+4
| | | | | | be performed by using Decl::isInStdNamespace or DeclContext::isStdNamespace llvm-svn: 209708
* [C++11] Use 'nullptr'. StaticAnalyzer edition.Craig Topper2014-05-2765-530/+550
| | | | llvm-svn: 209642
* revert "r209526 List the function/method name in the index page of scan-build "Sylvestre Ledru2014-05-231-4/+0
| | | | | | Depends on http://reviews.llvm.org/D3762 llvm-svn: 209527
* List the function/method name in the index page of scan-build Sylvestre Ledru2014-05-231-0/+4
| | | | llvm-svn: 209526
* Clean up language and grammar.Eric Christopher2014-05-201-1/+1
| | | | | | | Based on a patch by jfcaron3@gmail.com! PR19806 llvm-svn: 209215
* Fix typosAlp Toker2014-05-151-1/+1
| | | | llvm-svn: 208838
* Silence warning in Release builds. This function is only used in an assert.Benjamin Kramer2014-05-111-0/+2
| | | | llvm-svn: 208491
* Analyzer: Make helper function static.Benjamin Kramer2014-05-101-1/+1
| | | | llvm-svn: 208473
* Decouple ExprCXX.h and DeclCXX.h and clean up includes a bit.Benjamin Kramer2014-05-101-0/+1
| | | | | | | Required pulling LambdaExpr::Capture into its own header. No functionality change. llvm-svn: 208470
* NSOrCFErrorDerefChecker: Don't leak bug type. Similar to r208110/r208155. ↵Nico Weber2014-05-071-4/+12
| | | | | | Found by LSan. llvm-svn: 208251
* [analyzer] Use a lazily-initialized BugType in ObjCSelfInitChecker.Jordan Rose2014-05-071-10/+6
| | | | | | Follow-up to Nico's leak-stopping patch in r208110. llvm-svn: 208155
* [analyzer] Functions marked __attribute__((const)) don't modify any memory.Jordan Rose2014-05-071-0/+5
| | | | | | | | | This applies to __attribute__((pure)) as well, but 'const' is more interesting because many of our builtins are marked 'const'. PR19661 llvm-svn: 208154
* Fix leak in ObjCSelfInitChecker, found by LSan.Nico Weber2014-05-061-19/+18
| | | | | | | | BugReport doesn't take ownership of the bug type, so let the checker own the the bug type. (Requires making the bug type mutable, which is icky, but which is also what other checkers do.) llvm-svn: 208110
* Fix crash when resolving branch conditions for temporary destructor ↵Manuel Klimek2014-05-051-12/+34
| | | | | | | | | | | | | | | | | | | | condition blocks. Document and simplify ResolveCondition. 1. Introduce a temporary special case for temporary desctructors when resolving the branch condition - in an upcoming patch, alexmc will change temporary destructor conditions to not run through this logic, in which case we can remove this (marked as FIXME); this currently fixes a crash. 2. Simplify ResolveCondition; while documenting the function, I noticed that it always returns the last statement - either that statement is the condition itself (in which case the condition was returned anyway), or the rightmost leaf is returned; for correctness, the rightmost leaf must be evaluated anyway (which the CFG does in the last statement), thus we can just return the last statement in that case, too. Added an assert to verify the invariant. llvm-svn: 207957
* [leaks] The PDFileEntry nodes in the FilesMade FoldingSet containChandler Carruth2014-05-031-0/+5
| | | | | | | | a std::vector that allocates on the heap. As a consequence, we have to run all of their destructors when tearing down the set, not just deallocate the memory blobs. llvm-svn: 207902
* Updated the attribute tablegen emitter for variadic arguments to emit a ↵Aaron Ballman2014-05-021-3/+2
| | | | | | range accessor in addition to the iterators. Updated code using iterators to use range-based for loops. llvm-svn: 207837
* [analyzer] Don't assert when combining using .* on a temporary.Jordan Rose2014-04-291-0/+6
| | | | | | | | | | | | | While we don't model pointer-to-member operators yet (neither .* nor ->*), CallAndMessageChecker still checks to make sure the 'this' object is not null or undefined first. However, it also expects that the object should always have a valid MemRegion, something that's generally important elsewhere in the analyzer as well. Ensure this is true ahead of time, just like we do for member access. PR19531 llvm-svn: 207561
* [analyzer] Don't crash when a construction is followed by an uninitialized ↵Jordan Rose2014-04-291-1/+1
| | | | | | | | | | variable. This could happen due to unfortunate CFG coincidences. PR19579 llvm-svn: 207486
* [analyzer] Fix a leak found by LSan.Jordan Rose2014-04-231-4/+4
| | | | | | PR19524 llvm-svn: 207001
* Don't pass llvm::DenseSet<> by value.Alexander Kornienko2014-04-231-4/+4
| | | | | | | | | | | | | | Summary: Fixes massive performance problems on large translation units. Reviewers: jordan_rose Reviewed By: jordan_rose Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D3471 llvm-svn: 206999
* [Modules] Fix potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-226-12/+12
| | | | | | | | | | definition below all of the header #include lines, clang edition. If you want more details about this, you can see some of the commits to Debug.h in LLVM recently. This is just the clang section of a cleanup I've done for all uses of DEBUG_TYPE in LLVM. llvm-svn: 206849
* Add missing include.Richard Trieu2014-04-091-0/+1
| | | | llvm-svn: 205828
* [analyzer] When checking Foundation method calls, match the selectors exactly.Jordan Rose2014-04-094-76/+154
| | | | | | | | | | This also includes some infrastructure to make it easier to build multi-argument selectors, rather than trying to use string matching on each piece. There's a bit more setup code, but less cost at runtime. PR18908 llvm-svn: 205827
* [analyzer] Look through temporary destructors when finding a region to ↵Jordan Rose2014-04-051-2/+10
| | | | | | | | | | | | construct. Fixes a false positive when temporary destructors are enabled where a temporary is destroyed after a variable is constructed but before the VarDecl itself is processed, which occurs when the variable is in the condition of an if or while. Patch by Alex McCarthy, with an extra test from me. llvm-svn: 205661
* [analyzer] Extract a helper for finding the target region for a C++ constructor.Jordan Rose2014-04-011-56/+65
| | | | | | | | No functionality change. Patch by Alex McCarthy! llvm-svn: 205328
* [analyzer] Remove incorrect workaround for unimplemented temporary destructors.Jordan Rose2014-04-011-6/+0
| | | | | | | | | | If we're trying to get the zero element region of something that's not a region, we should be returning UnknownVal, which is what ProgramState::getLValue will do for us. Patch by Alex McCarthy! llvm-svn: 205327
* [analyzer] Lock checker: Allow pthread_mutex_init to reinitialize a ↵Jordan Rose2014-04-011-0/+39
| | | | | | | | destroyed lock. Patch by Daniel Fahlgren! llvm-svn: 205276
* [analyzer] Lock checker: make sure locks aren't used after being destroyed.Jordan Rose2014-04-011-29/+121
| | | | | | Patch by Daniel Fahlgren! llvm-svn: 205275
* [analyzer] Add double-unlock detection to PthreadLockChecker.Jordan Rose2014-04-011-17/+36
| | | | | | | | | We've decided to punt on supporting recursive locks for now; the common case is non-recursive. Patch by Daniel Fahlgren! llvm-svn: 205274
* [analyzer] Handle the M_ZERO and __GFP_ZERO flags in kernel mallocs.Jordan Rose2014-03-262-5/+115
| | | | | | | | | | | | | | | | | | | | | Add M_ZERO awareness to malloc() static analysis in Clang for FreeBSD, NetBSD, and OpenBSD in a similar fashion to O_CREAT for open(2). These systems have a three-argument malloc() in the kernel where the third argument contains flags; the M_ZERO flag will zero-initialize the allocated buffer. This should reduce the number of false positives when running static analysis on BSD kernels. Additionally, add kmalloc() (Linux kernel malloc()) and treat __GFP_ZERO like M_ZERO on Linux. Future work involves a better method of checking for named flags without hardcoding values. Patch by Conrad Meyer, with minor modifications by me. llvm-svn: 204832
* [analyzer] Don't track retain counts of objects directly accessed through ivars.Jordan Rose2014-03-251-22/+111
| | | | | | | | | | | | | | | | | | | | | A refinement of r198953 to handle cases where an object is accessed both through a property getter and through direct ivar access. An object accessed through a property should always be treated as +0, i.e. not owned by the caller. However, an object accessed through an ivar may be at +0 or at +1, depending on whether the ivar is a strong reference. Outside of ARC, we don't have that information, so we just don't track objects accessed through ivars. With this change, accessing an ivar directly will deliberately override the +0 provided by a getter, but only if the +0 hasn't participated in other retain counting yet. That isn't perfect, but it's already unusual for people to be mixing property access with direct ivar access. (The primary use case for this is in setters, init methods, and -dealloc.) Thanks to Ted for spotting a few mistakes in private review. <rdar://problem/16333368> llvm-svn: 204730
OpenPOWER on IntegriCloud