summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Check all conditions in a chained if against each other.Jordan Rose2014-03-111-0/+24
| | | | | | | | | | | | Like the binary operator check of r201702, this actually checks the condition of every if in a chain against every other condition, an O(N^2) operation. In most cases N should be small enough to make this practical, and checking all cases like this makes it much more likely to catch a copy-paste error within the same series of branches. Part of IdenticalExprChecker; patch by Daniel Fahlgren! llvm-svn: 203585
* [C++11] Replacing DeclBase iterators specific_attr_begin() and ↵Aaron Ballman2014-03-104-38/+13
| | | | | | specific_attr_end() with iterator_range specific_attrs(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203474
* [C++11] Replacing RecordDecl iterators field_begin() and field_end() with ↵Aaron Ballman2014-03-082-10/+7
| | | | | | iterator_range fields(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203355
* [C++11] Revert uses of lambdas with array_pod_sort.Benjamin Kramer2014-03-071-5/+6
| | | | | | Looks like GCC implements the lambda->function pointer conversion differently. llvm-svn: 203293
* [C++11] Convert sort predicates into lambdas.Benjamin Kramer2014-03-071-6/+5
| | | | | | No functionality change. llvm-svn: 203289
* Replace OwningPtr with std::unique_ptr.Ahmed Charles2014-03-0739-92/+91
| | | | | | This compiles cleanly with lldb/lld/clang-tools-extra/llvm. llvm-svn: 203279
* [C++11] Replacing DeclBase iterators decls_begin() and decls_end() with ↵Aaron Ballman2014-03-071-3/+2
| | | | | | iterator_range decls(). The same is true for the noload versions of these APIs. Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203278
* [C++11] Replacing ObjCMethodDecl iterators param_begin() and param_end() ↵Aaron Ballman2014-03-071-3/+2
| | | | | | with iterator_range params(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203255
* [C++11] Replacing FunctionDecl iterators param_begin() and param_end() with ↵Aaron Ballman2014-03-071-3/+2
| | | | | | iterator_range params(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203248
* [C++11] Replace llvm::tie with std::tie.Benjamin Kramer2014-03-0216-45/+43
| | | | llvm-svn: 202639
* [analyzer] check for now possibly null predecessor edge.Ted Kremenek2014-02-271-0/+5
| | | | llvm-svn: 202434
* [CMake] Use LINK_LIBS instead of target_link_libraries().NAKAMURA Takumi2014-02-261-2/+1
| | | | llvm-svn: 202238
* [analyzer] NonNullParamChecker: don't freak out about nested transparent_unions.Jordan Rose2014-02-261-1/+3
| | | | | | | | | For now, just ignore them. Later, we could try looking through LazyCompoundVals, but we at least shouldn't crash. <rdar://problem/16153464> llvm-svn: 202212
* [CMake] Get rid of explicit dependencies to include/clang/*.inc and ↵NAKAMURA Takumi2014-02-211-8/+1
| | | | | | | | | | | | | | | | | | | introduce CLANG_TABLEGEN_TARGETS. This does; - clang_tablegen() adds each tblgen'd target to global property CLANG_TABLEGEN_TARGETS as list. - List of targets is added to LLVM_COMMON_DEPENDS. - all clang libraries and targets depend on generated headers. You might wonder this would be regression, but in fact, this is little loss. - Almost all of clang libraries depend on tblgen'd files and clang-tblgen. - clang-tblgen may cause short stall-out but doesn't cause unconditional rebuild. - Each library's dependencies to tblgen'd files might vary along headers' structure. It made hard to track and update *really optimal* dependencies. Each dependency to intrinsics_gen and ClangSACheckers is left as DEPENDS. llvm-svn: 201842
* [analyzer] Fix a bug in IdenticalExprChecker concerning while loops.Jordan Rose2014-02-211-2/+7
| | | | | | | | | Somehow both Daniel and I missed the fact that while loops are only identical if they have identical bodies. Patch by Daniel Fahlgren! llvm-svn: 201829
* [analyzer] Extend IdenticalExprChecker to check logical and bitwise expressions.Jordan Rose2014-02-191-12/+75
| | | | | | | | | | | IdenticalExprChecker now warns if any expressions in a logical or bitwise chain (&&, ||, &, |, or ^) are the same. Unlike the previous patch, this actually checks all subexpressions against each other (an O(N^2) operation, but N is likely to be small). Patch by Daniel Fahlgren! llvm-svn: 201702
* [analyzer] Extend IdenticalExprChecker to check the two branches of an if.Jordan Rose2014-02-191-51/+188
| | | | | | | | | | | | | | | This extends the checks for identical expressions to handle identical statements, and compares the consequent and alternative ("then" and "else") branches of an if-statement to see if they are identical, treating a single statement surrounded by braces as equivalent to one without braces. This does /not/ check subsequent branches in an if/else chain, let alone branches that are not consecutive. This may improve in a future patch, but it would certainly take more work. Patch by Daniel Fahlgren! llvm-svn: 201701
* [analyzer] Move checker alpha.osx.cocoa.MissingSuperCall out of alpha category.Ted Kremenek2014-02-191-4/+4
| | | | llvm-svn: 201640
* [analyzer] Teach CastSizeChecker about flexible array members.Jordan Rose2014-02-181-12/+72
| | | | | | | | | ...as well as fake flexible array members: structs that end in arrays with length 0 or 1. Patch by Daniel Fahlgren! llvm-svn: 201583
* [analyzer] Improved checker naming in CFG dump.Anton Yartsev2014-02-175-19/+20
| | | | | | This implements FIXME from Checker.cpp (FIXME: We want to return the package + name of the checker here.) and replaces hardcoded checker names with the new ones obtained via getCheckName().getName(). llvm-svn: 201525
* Expose the name of the checker producing each diagnostic message.Alexander Kornienko2014-02-1159-429/+544
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In clang-tidy we'd like to know the name of the checker producing each diagnostic message. PathDiagnostic has BugType and Category fields, which are both arbitrary human-readable strings, but we need to know the exact name of the checker in the form that can be used in the CheckersControlList option to enable/disable the specific checker. This patch adds the CheckName field to the CheckerBase class, and sets it in the CheckerManager::registerChecker() method, which gets them from the CheckerRegistry. Checkers that implement multiple checks have to store the names of each check in the respective registerXXXChecker method. Reviewers: jordan_rose, krememek Reviewed By: jordan_rose CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2557 llvm-svn: 201186
* [analyzer] Objective-C object literals are always non-nil.Jordan Rose2014-02-081-4/+26
| | | | | | <rdar://problem/15999214> llvm-svn: 201007
* [CMake] Prune stray entries in add_dependencies(). target_link_libraries() ↵NAKAMURA Takumi2014-01-311-1/+0
| | | | | | implies it. llvm-svn: 200531
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-253-10/+10
| | | | | | | | | | | | | | | A return type is the declared or deduced part of the function type specified in the declaration. A result type is the (potentially adjusted) type of the value of an expression that calls the function. Rule of thumb: * Declarations have return types and parameters. * Expressions have result types and arguments. llvm-svn: 200082
* [analyzer] Future-proof MallocChecker CFG dumping.Jordan Rose2014-01-231-7/+7
| | | | | | Now we'll get a warning if we miss a case. Refinement of r199800. llvm-svn: 199868
* [analyzer] The patch prevents the analyzer from crashing during CFG dump.Anton Yartsev2014-01-221-1/+2
| | | | llvm-svn: 199800
* Rename FunctionProtoType accessors from 'arguments' to 'parameters'Alp Toker2014-01-202-18/+17
| | | | | | | | | | | | | | | | | Fix a perennial source of confusion in the clang type system: Declarations and function prototypes have parameters to which arguments are supplied, so calling these 'arguments' was a stretch even in C mode, let alone C++ where default arguments, templates and overloading make the distinction important to get right. Readability win across the board, especially in the casting, ADL and overloading implementations which make a lot more sense at a glance now. Will keep an eye on the builders and update dependent projects shortly. No functional change. llvm-svn: 199686
* [analyzer] Fix incorrect spelling of 'pthread_rwlock_trywrlock'. Patch by ↵Ted Kremenek2014-01-171-5/+5
| | | | | | Jean Baptiste Noblot. llvm-svn: 199499
* [analyzer] Teach NonNullParamChecker about 'nonnull' attributes on parameters.Ted Kremenek2014-01-171-1/+7
| | | | llvm-svn: 199473
* [analyzer] BlockCall shouldn't really be an AnyFunctionCall.Jordan Rose2014-01-152-5/+5
| | | | | | | | | | | | | | Per discussion with Anna a /long/ time ago, it was way too easy to misuse BlockCall: because it inherited from AnyFunctionCall (through SimpleCall), getDecl() was constrained to return a FunctionDecl, and you had to call getBlockDecl() instead. This goes against the whole point of CallEvent (to abstract over different ways to invoke bodies of code). Now, BlockCall just inherits directly from CallEvent. There's a bit of duplication in getting things out of the origin expression (which is still known to be a CallExpr), but nothing significant. llvm-svn: 199321
* [analyzer] Print function name when dumping its CFG.Jordan Rose2014-01-151-0/+5
| | | | | | | | This allows us to use CHECK-LABEL to ensure that we're checking the right CFG. Debugging change only. llvm-svn: 199320
* Teach DeadStoresChecker about attribute objc_precise_lifetime.Ted Kremenek2014-01-151-3/+6
| | | | llvm-svn: 199277
* [analyzer] Model getters of known-@synthesized Objective-C properties.Jordan Rose2014-01-101-0/+19
| | | | | | | | | | | | | | | | | | | | | ...by synthesizing their body to be "return self->_prop;", with an extra nudge to RetainCountChecker to still treat the value as +0 if we have no other information. This doesn't handle weak properties, but that's mostly correct anyway, since they can go to nil at any time. This also doesn't apply to properties whose implementations we can't see, since they may not be backed by an ivar at all. And finally, this doesn't handle properties of C++ class type, because we can't invoke the copy constructor. (Sema has actually done this work already, but the AST it synthesizes is one the analyzer doesn't quite handle -- it has an rvalue DeclRefExpr.) Modeling setters is likely to be more difficult (since it requires handling strong/copy), but not impossible. <rdar://problem/11956898> llvm-svn: 198953
* [analyzer] Warn about double-delete in C++ at the second delete...Jordan Rose2014-01-081-2/+42
| | | | | | | | | | ...rather somewhere in the destructor when we try to access something and realize the object has already been deleted. This is necessary because the destructor is processed before the 'delete' itself. Patch by Karthik Bhat! llvm-svn: 198779
* [analyzer] Pointers escape into +[NSValue valueWithPointer:]...Jordan Rose2014-01-071-1/+2
| | | | | | | | | | ...even though the argument is declared "const void *", because this is just a way to pass pointers around as objects. (Though NSData is often a better one.) PR18262 llvm-svn: 198710
* [analyzer] Remove unused ARCNotOwnedSymbol retain count return effect.Jordan Rose2014-01-071-3/+2
| | | | | | | | | | | | RetainCountChecker has to track returned object values to know if they are retained or not. Under ARC, even methods that return +1 are tracked by the system and should be treated as +0. However, this effect behaves exactly like NotOwned(ObjC), i.e. a generic Objective-C method that actually returns +0, so we don't need a special case for it. No functionality change. llvm-svn: 198709
* Sort all the #include lines with LLVM's utils/sort_includes.py whichChandler Carruth2014-01-072-4/+3
| | | | | | | encodes the canonical rules for LLVM's style. I noticed this had drifted quite a bit when cleaning up LLVM, so wanted to clean up Clang as well. llvm-svn: 198686
* Only mark dump() function definitions 'used' in debug buildsAlp Toker2014-01-041-3/+1
| | | | | | | | | | | | | | | | This has the dual effect of (1) enabling more dead-stripping in release builds and (2) ensuring that debug helper functions aren't stripped away in debug builds, as they're intended to be called from the debugger. Note that the attribute is applied to definitions rather than declarations in headers going forward because it's now conditional on NDEBUG: /// \brief Mark debug helper function definitions like dump() that should not be /// stripped from debug builds. Requires corresponding macro added in LLVM r198456. llvm-svn: 198489
* [analyzer] Remove IdempotentOperations checker.Ted Kremenek2014-01-043-741/+0
| | | | | | | | | This checker has not been updated to work with interprocedural analysis, and actually contains both logical correctness issues but also memory bugs. We can resuscitate it from version control once there is focused interest in making it a real viable checker again. llvm-svn: 198476
* Fixed a FIXME; created a print method for Selectors that accepts a ↵Aaron Ballman2014-01-034-12/+18
| | | | | | | | raw_ostream, and started using it in places it made sense. No functional changes intended, just API cleanliness. llvm-svn: 198428
* [analyzer] Don't track return value of NSNull +null for retain/release tracking.Ted Kremenek2014-01-031-0/+5
| | | | | | Fixes <rdar://problem/12858915>. llvm-svn: 198388
* Fixing a compile error that recently started happening for me in MSVC 2013. ↵Aaron Ballman2013-12-291-1/+1
| | | | | | CFGTerminator has an explicit conversion to bool operator that we can make use of instead of using == 0. llvm-svn: 198175
* Rename isBuiltinCall() to getBuiltinCallee()Alp Toker2013-12-281-1/+1
| | | | | | | | This better describes what the function does. Cleanup only. llvm-svn: 198127
* Replacing calls to getAttr with calls to hasAttr for clarity. No functional ↵Aaron Ballman2013-12-196-22/+22
| | | | | | change intended -- this only replaces Boolean uses of getAttr. llvm-svn: 197648
* Eliminate BinaryTypeTraitExprAlp Toker2013-12-131-1/+0
| | | | | | | | | | | | | | | | | There's nothing special about type traits accepting two arguments. This commit eliminates BinaryTypeTraitExpr and switches all related handling over to TypeTraitExpr. Also fixes a CodeGen failure with variadic type traits appearing in a non-constant expression. The BTT/TT prefix and evaluation code is retained as-is for now but will soon be further cleaned up. This is part of the ongoing work to unify type traits. llvm-svn: 197273
* [analyzer] Misc. tidying in IdenticalExprChecker.Jordan Rose2013-12-101-18/+16
| | | | | | Some things I missed when this first went in. llvm-svn: 196938
* [analyzer] Extend IdenticalExprChecker to check ternary operator results.Jordan Rose2013-12-101-7/+39
| | | | | | | | | | Warn if both result expressions of a ternary operator (? :) are the same. Because only one of them will be executed, this warning will fire even if the expressions have side effects. Patch by Anders Rönnholm and Per Viberg! llvm-svn: 196937
* [CMake] clang/lib: Satisfy dependencies to add *actually used* libraries on ↵NAKAMURA Takumi2013-12-091-1/+6
| | | | | | | | target_link_libraries() and LLVM_LINK_COMPONENTS. I will prune redundant dependencies later. llvm-svn: 196800
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-1/+1
| | | | llvm-svn: 196510
* Correct a user-visible static analyzer message typoAlp Toker2013-12-021-2/+2
| | | | llvm-svn: 196062
OpenPOWER on IntegriCloud