summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] RetainCountChecker: don't try to track ivars known to be nil.Jordan Rose2015-02-191-2/+4
| | | | | | | | | | | We expect in general that any nil value has no retain count information associated with it; violating this results in unexpected state unification /later/ when we decide to throw the information away. Unexpectedly caching out can lead to an assertion failure or crash. rdar://problem/19862648 llvm-svn: 229934
* [analyzer] Different handling of alloca().Anton Yartsev2015-02-191-30/+78
| | | | | | | | | | + separate bug report for "Free alloca()" error to be able to customize checkers responsible for this error. + Muted "Free alloca()" error for NewDelete checker that is not responsible for c-allocated memory, turned on for unix.MismatchedDeallocator checker. + RefState for alloca() - to be able to detect usage of zero-allocated memory by upcoming ZeroAllocDereference checker. + AF_Alloca family to handle alloca() consistently - keep proper family in RefState, handle 'alloca' by getCheckIfTracked() facility, etc. + extra tests. llvm-svn: 229850
* [analyzer] Refactoring: clarified the way the proper check kind is chosen.Anton Yartsev2015-02-181-64/+86
| | | | llvm-svn: 229593
* Prefer SmallVector::append/insert over push_back loops. Clang edition.Benjamin Kramer2015-02-171-5/+2
| | | | | | Same functionality, but hoists the vector growth out of the loop. llvm-svn: 229508
* Analyzer: Replace a set of particularly ugly faux variadics.Benjamin Kramer2015-02-151-8/+0
| | | | llvm-svn: 229325
* [analyzer] Pass actual state to alloc/dealloc handling functions.Anton Yartsev2015-02-101-43/+78
| | | | | | The state obtained from CheckerContext::getState() may be outdated by the time the alloc/dealloc handling function is called (e.g. the state was modified but the transition was not performed). State argument was added to all alloc/dealloc handling functions in order to get the latest state and to allow sequential calls to those functions. llvm-svn: 228737
* [Static Analyzer] The name of the checker that reports a bug is addedGabor Horvath2015-02-091-1/+3
| | | | | | | | | | | to the plist output. This check_name field does not guaranteed to be the same as the name of the checker in the future. Reviewer: Anna Zaks Differential Revision: http://reviews.llvm.org/D6841 llvm-svn: 228624
* Update APIs that return a pair of iterators to return an iterator_range instead.Benjamin Kramer2015-02-064-34/+31
| | | | | | Convert uses of those APIs into ranged for loops. NFC. llvm-svn: 228404
* [analyzer] Relax an assertion in VisitLvalArraySubscriptExprAnna Zaks2015-02-051-1/+3
| | | | | | | | | | | | The analyzer thinks that ArraySubscriptExpr cannot be an r-value (ever). However, it can be in some corner cases. Specifically, C forbids expressions of unqualified void type from being l-values. Note, the analyzer will keep modeling the subscript expr as an l-value. The analyzer should be treating void* as a char array (https://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Pointer-Arith.html). llvm-svn: 228249
* [analyzer] Do not crash in the KeychainAPI checker on user defined 'free()'.Anna Zaks2015-02-051-2/+10
| | | | llvm-svn: 228248
* [analyzer] Look for allocation site in the parent frames as well as the ↵Anna Zaks2015-02-053-26/+23
| | | | | | | | | | | | | current one. Instead of handling edge cases (mostly involving blocks), where we have difficulty finding an allocation statement, allow the allocation site to be in a parent node. Previously we assumed that the allocation site can always be found in the same frame as allocation, but there are scenarios in which an element is leaked in a child frame but is allocated in the parent. llvm-svn: 228247
* [analyzer] Don't skip analyzing the functions in preprocessed files.Anna Zaks2015-02-051-1/+1
| | | | | | | The change in main file detection ended up disabling the path-sensitive analysis of functions within preprocessed files. llvm-svn: 228246
* [analyzer] RetainCountChecker: be forgiving when ivars are accessed directly.Jordan Rose2015-02-041-82/+216
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A refinement of r204730, itself a refinement of r198953, to better 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 always have that information. The previous attempt would clear out the +0 provided by a getter, but only if that +0 hadn't already participated in other retain counting operations. (That is, "self.foo" is okay, but "[[self.foo retain] autorelease]" is problematic.) This turned out to not be good enough when our synthesized getters get involved. This commit drops the notion of "overridable" reference counting and instead just tracks whether a value ever came from a (strong) ivar. If it has, we allow one more release than we otherwise would. This has the added benefit of being able to catch /some/ overreleases of instance variables, though it's not likely to come up in practice. We do still get some false negatives because we currently throw away refcount state upon assigning a value into an ivar. We should probably improve on that in the future, especially once we synthesize setters as well as getters. rdar://problem/18075108 llvm-svn: 228174
* Fix layering violation: include/clang/Basic/PlistSupport.h should not includeRichard Smith2015-01-281-11/+11
| | | | | | files from include/clang/Lex. Clean up module map. llvm-svn: 227361
* Test commit, no changes.Pavel Labath2015-01-201-1/+1
| | | | llvm-svn: 226552
* Remove std::move that was preventing return value optimization.Richard Trieu2015-01-171-1/+1
| | | | llvm-svn: 226357
* [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-144-17/+14
| | | | | | | | | | Sorry for the noise, I managed to miss a bunch of recent regressions of include orderings here. This should actually sort all the includes for Clang. Again, no functionality changed, this is just a mechanical cleanup that I try to run periodically to keep the #include lines as regular as possible across the project. llvm-svn: 225979
* Use nullptr to silence -Wsentinel when self-hosting on WindowsReid Kleckner2014-12-011-7/+7
| | | | | | | | | | | Richard rejected my Sema change to interpret an integer literal zero in a varargs context as a null pointer, so -Wsentinel sees an integer literal zero and fires off a warning. Only CodeGen currently knows that it promotes integer literal zeroes in this context to pointer size on Windows. I didn't want to teach -Wsentinel about that compatibility hack. Therefore, I'm migrating to C++11 nullptr. llvm-svn: 223079
* Update for LLVM API change to make Small(Ptr)Set::insert return ↵David Blaikie2014-11-191-1/+1
| | | | | | pair<iterator, bool> as per the C++ standard's associative container concept. llvm-svn: 222335
* clang-format a recent commit I madeDavid Blaikie2014-11-191-1/+1
| | | | llvm-svn: 222317
* Standardize on StringMap::insert, removing uses of StringMap::GetOrCreateValue.David Blaikie2014-11-192-13/+12
| | | | llvm-svn: 222306
* Remove some redundant virtual specifiers on overriden functions.David Blaikie2014-11-141-1/+1
| | | | llvm-svn: 222024
* [c++1z] N4295: fold-expressions.Richard Smith2014-11-081-0/+1
| | | | | | | | | | | | | | | | This is a new form of expression of the form: (expr op ... op expr) where one of the exprs is a parameter pack. It expands into (expr1 op (expr2onwards op ... op expr)) (and likewise if the pack is on the right). The non-pack operand can be omitted; in that case, an empty pack gives a fallback value or an error, depending on the operator. llvm-svn: 221573
* [llvm-api-change] Use findProgramByName.Michael J. Spencer2014-11-041-1/+3
| | | | llvm-svn: 221222
* Use the new LLVM_END_WITH_NULL nameReid Kleckner2014-11-041-2/+2
| | | | llvm-svn: 221217
* Add the initial TypoExpr AST node for delayed typo correction.Kaelyn Takata2014-10-271-0/+1
| | | | llvm-svn: 220692
* [analyzer] Move the NewDeleteLeaks checker from CplusplusAlpha to Cplusplus ↵Anton Yartsev2014-10-211-4/+4
| | | | | | package. llvm-svn: 220289
* [analyzer] Tweak MallocSizeOfChecker to not warn when using sizeof(void*) to ↵Ted Kremenek2014-10-191-0/+4
| | | | | | | | | | | allocate a bunch of any pointer type. This suppresses a common false positive when analyzing libc++. Along the way, introduce some tests to show this checker actually works with C++ static_cast<>. llvm-svn: 220160
* [analyzer] Check all 'nonnull' attributes, not just the first one.Jordan Rose2014-10-131-5/+16
| | | | | | Patch by Daniel Fahlgren! llvm-svn: 219625
* Reduce double set lookups. NFC.Benjamin Kramer2014-10-101-7/+2
| | | | llvm-svn: 219504
* [Analysis] Add missing newlines at end of file.Daniel Dunbar2014-10-092-2/+2
| | | | llvm-svn: 219439
* Fix for bug http://llvm.org/PR17427.Alexey Bataev2014-10-091-1/+1
| | | | | | | | Assertion failed: "Computed __func__ length differs from type!" Reworked PredefinedExpr representation with internal StringLiteral field for function declaration. Differential Revision: http://reviews.llvm.org/D5365 llvm-svn: 219393
* [OPENMP] 'omp teams' directive basic support.Alexey Bataev2014-10-091-0/+1
| | | | | | Includes parsing and semantic analysis for 'omp teams' directive support from OpenMP 4.0. Adds additional analysis to 'omp target' directive with 'omp teams' directive. llvm-svn: 219385
* Revert "[OPENMP] 'omp teams' directive basic support. Includes parsing and ↵Renato Golin2014-10-081-1/+0
| | | | | | | | | semantic analysis for 'omp teams' directive support from OpenMP 4.0. Adds additional analysis to 'omp target' directive with 'omp teams' directive." This reverts commit r219197 because it broke ARM self-hosting buildbots with segmentation fault errors in many tests. llvm-svn: 219289
* [OPENMP] 'omp teams' directive basic support.Alexey Bataev2014-10-071-0/+1
| | | | | | Includes parsing and semantic analysis for 'omp teams' directive support from OpenMP 4.0. Adds additional analysis to 'omp target' directive with 'omp teams' directive. llvm-svn: 219197
* Remove stray enum keywords. MSVC sees this as a redeclaration at global scope.Benjamin Kramer2014-10-031-2/+2
| | | | llvm-svn: 219031
* [analyzer] Refactor and cleanup IsCompleteTypeAnna Zaks2014-10-033-37/+4
| | | | | | | | | | There are three copies of IsCompleteType(...) functions in CSA and all of them are incomplete (I experienced crashes in some CSA's test cases). I have replaced these function calls with Type::isIncompleteType() calls. A patch by Aleksei Sidorin! llvm-svn: 219026
* [analyzer] Make Malloc Checker track memory allocated by if_nameindexAnna Zaks2014-10-031-37/+81
| | | | | | | | | | | | | | | The MallocChecker does currently not track the memory allocated by if_nameindex. That memory is dynamically allocated and should be freed by calling if_freenameindex. The attached patch teaches the checker about these functions. Memory allocated by if_nameindex is treated as a separate allocation "family". That way the checker can verify it is freed by the correct function. A patch by Daniel Fahlgren! llvm-svn: 219025
* [analyzer] Make CStringChecker correctly calculate return value of mempcpyAnna Zaks2014-10-031-1/+6
| | | | | | | | | | The return value of mempcpy is only correct when the destination type is one byte in size. This patch casts the argument to a char* so the calculation is also correct for structs, ints etc. A patch by Daniel Fahlgren! llvm-svn: 219024
* [OPENMP] Parsing/Sema of directive omp parallel for simdAlexander Musman2014-09-231-0/+1
| | | | llvm-svn: 218299
* [OPENMP] Initial parsing/sema analysis of 'target' directive.Alexey Bataev2014-09-191-0/+1
| | | | llvm-svn: 218110
* Parsing/Sema of directive omp for simdAlexander Musman2014-09-181-0/+1
| | | | llvm-svn: 218029
* Avoid some unnecessary SmallVector copies.Benjamin Kramer2014-09-111-8/+6
| | | | | | No functionality change. llvm-svn: 217586
* Teach the analyzer that __builtin_assume_aligned returns its first argument.Jordan Rose2014-09-091-1/+3
| | | | | | Patch by Daniel Fahlgren! llvm-svn: 217461
* [analyzer] Don't crash if malloc() has an unexpected function prototype.Jordan Rose2014-09-051-4/+4
| | | | | | Patch by Daniel Fahlgren! llvm-svn: 217258
* unique_ptrify AnalysisConsumer.cpp::CreateUbiVizDavid Blaikie2014-09-051-4/+4
| | | | llvm-svn: 217212
* Remove a use of raw pointer ownership (then non-ownership) in ↵David Blaikie2014-09-051-2/+3
| | | | | | | | | TrimmedGraph::popNextReportGraph (just cleaning up unique_ptr stuff by finding interesting 'reset' calls at the moment) llvm-svn: 217210
* unique_ptrify ExplodedGraph::trimDavid Blaikie2014-09-052-4/+4
| | | | llvm-svn: 217208
* unique_ptrify the result of ConstraintManagerCreator and StoreManagerCreatorDavid Blaikie2014-09-043-8/+9
| | | | llvm-svn: 217206
* unique_ptrify BugReporter::visitorsDavid Blaikie2014-09-047-91/+71
| | | | llvm-svn: 217205
OpenPOWER on IntegriCloud