summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Inline C++ operator new when c++-inline-allocators is turned on.Jordan Rose2014-02-115-5/+52
| | | | | | | | | This will let us stage in the modeling of operator new. The -analyzer-config opton 'c++-inline-allocators' is currently off by default. Patch by Karthik Bhat! llvm-svn: 201122
* [analyzer] Objective-C object literals are always non-nil.Jordan Rose2014-02-081-4/+26
| | | | | | <rdar://problem/15999214> llvm-svn: 201007
* [analyzer] Just silence all warnings coming out of std::basic_string.Jordan Rose2014-02-071-11/+4
| | | | | | | | | This means always walking the whole call stack for the end path node, but we'll assume that's always fairly tractable. <rdar://problem/15952973> llvm-svn: 200980
* Allow specifying a custom PathDiagnosticConsumer for use with the static ↵Alexander Kornienko2014-02-031-19/+27
| | | | | | | | | | | | | | | | | analyzer. Summary: Make objects returned by CreateAnalysisConsumer expose an interface, that allows providing a custom PathDiagnosticConsumer, so that users can have raw data in a form easily usable from the code (unlike plist/HTML in a file). Reviewers: jordan_rose, krememek CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2556 llvm-svn: 200710
* [CMake] Prune stray entries in add_dependencies(). target_link_libraries() ↵NAKAMURA Takumi2014-01-312-3/+0
| | | | | | implies it. llvm-svn: 200531
* [CMake] clangStaticAnalyzerFrontend: Deprecate LLVM_NO_RTTI.NAKAMURA Takumi2014-01-281-2/+0
| | | | llvm-svn: 200296
* Rename getResultType() on function and method declarations to getReturnType()Alp Toker2014-01-254-13/+13
| | | | | | | | | | | | | | | 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
* PlistSupport: Eliminate duplicated EmitLocation() and EmitRange() functionsAlp Toker2014-01-251-21/+8
| | | | llvm-svn: 200077
* PlistSupport: Unify ARCMigrate / StaticAnalyzer plist writersAlp Toker2014-01-251-73/+6
| | | | | | | | Reduces the ARCMT migrator plist writer down to a single function, arcmt::writeARCDiagsToPlist() which shares supporting functions with the analyzer plist writer. llvm-svn: 200075
* [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
* Change CallEvent to use ArrayRef<> interface to get formal parameters of callee.Ted Kremenek2014-01-172-44/+17
| | | | llvm-svn: 199472
* [analyzer] Shitfing a constant value by its bit width is undefined.Jordan Rose2014-01-161-2/+2
| | | | | | | | | Citation: C++11 [expr.shift]p1 (and the equivalent text in C11). This fixes PR18073, but the right thing to do (as noted in the FIXME) is to have a real checker for too-large shifts. llvm-svn: 199405
* [analyzer] BlockCall shouldn't really be an AnyFunctionCall.Jordan Rose2014-01-153-9/+9
| | | | | | | | | | | | | | 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] Add a CFG node for the allocator call in a C++ 'new' expression.Jordan Rose2014-01-132-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | In an expression like "new (a, b) Foo(x, y)", two things happen: - Memory is allocated by calling a function named 'operator new'. - The memory is initialized using the constructor for 'Foo'. Currently the analyzer only models the second event, though it has special cases for both the default and placement forms of operator new. This patch is the first step towards properly modeling both events: it changes the CFG so that the above expression now generates the following elements. 1. a 2. b 3. (CFGNewAllocator) 4. x 5. y 6. Foo::Foo The analyzer currently ignores the CFGNewAllocator element, but the next step is to treat that as a call like any other. The CFGNewAllocator element is not added to the CFG for analysis-based warnings, since none of them take advantage of it yet. llvm-svn: 199123
* [analyzer] Model getters of known-@synthesized Objective-C properties.Jordan Rose2014-01-102-1/+28
| | | | | | | | | | | | | | | | | | | | | ...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-082-3/+47
| | | | | | | | | | ...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-072-1/+13
| | | | | | | | | | ...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-074-6/+5
| | | | | | | 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-044-15/+6
| | | | | | | | | | | | | | | | 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-035-13/+21
| | | | | | | | raw_ostream, and started using it in places it made sense. No functional changes intended, just API cleanliness. llvm-svn: 198428
* Make clang::ento::CreateAnalysisConsumer a part of a public interface of the ↵Alexander Kornienko2014-01-033-45/+2
| | | | | | | | | | | | | | | | | | static analyzer. Summary: This allows for a better alternative to the FrontendAction hack used in clang-tidy in order to get static analyzer's ASTConsumer. Reviewers: jordan_rose, krememek Reviewed By: jordan_rose CC: cfe-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2505 llvm-svn: 198426
* [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
* Eliminate UnaryTypeTraitExprAlp Toker2014-01-011-1/+0
| | | | | | | | | | | | | Remove UnaryTypeTraitExpr and switch all remaining type trait related handling over to TypeTraitExpr. The UTT/BTT/TT enum prefix and evaluation code is retained pending further cleanup. This is part of the ongoing work to unify type traits following the removal of BinaryTypeTraitExpr in r197273. llvm-svn: 198271
* 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
* Fix another misuse of getCustomDiagID()Alp Toker2013-12-231-25/+13
| | | | | | There's no need to escape strings and generate new DiagIDs for each message. llvm-svn: 197915
* [analyzer] Use DataRecursiveASTVisitor for the AnalysisConsumer.Argyrios Kyrtzidis2013-12-201-2/+2
| | | | llvm-svn: 197767
* [analyzer] Always use 'bool' as the SValBuilder condition type in C++.Jordan Rose2013-12-192-2/+2
| | | | | | | | | We have assertions for this, but a few edge cases had snuck through where we were still unconditionally using 'int'. <rdar://problem/15703011> llvm-svn: 197733
* Replacing calls to getAttr with calls to hasAttr for clarity. No functional ↵Aaron Ballman2013-12-198-24/+24
| | | | | | change intended -- this only replaces Boolean uses of getAttr. llvm-svn: 197648
* Eliminate BinaryTypeTraitExprAlp Toker2013-12-132-2/+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] Add checker callbacks for MemberExpr and UnaryExprOrTypeTraitExpr.Jordan Rose2013-12-112-79/+98
| | | | | | Found by Arthur Yoo! llvm-svn: 197059
* Add front-end infrastructure now address space casts are in LLVM IR.David Tweed2013-12-111-0/+1
| | | | | | | | | | With the introduction of explicit address space casts into LLVM, there's a need to provide a new cast kind the front-end can create for C/OpenCL/CUDA and code to produce address space casts from those kinds when appropriate. Patch by Michele Scandale! llvm-svn: 197036
* [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-102-7/+47
| | | | | | | | | | 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: Prune redundant dependencies.NAKAMURA Takumi2013-12-102-4/+0
| | | | llvm-svn: 196864
* [CMake] clang/lib: Satisfy dependencies to add *actually used* libraries on ↵NAKAMURA Takumi2013-12-093-5/+17
| | | | | | | | target_link_libraries() and LLVM_LINK_COMPONENTS. I will prune redundant dependencies later. llvm-svn: 196800
* Revert "[analyzer] Refactor conditional expression evaluating code"Anna Zaks2013-12-062-74/+64
| | | | | | | | | | This reverts commit r189090. The original patch introduced regressions (see the added live-variables.* tests). The patch depends on the correctness of live variable analyses, which are not computed correctly. I've opened PR18159 to track the proper resolution to this problem. The patch was a stepping block to r189746. This is why part of the patch reverts temporary destructor tests that started crashing. The temporary destructors feature is disabled by default. llvm-svn: 196593
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-053-3/+3
| | | | llvm-svn: 196510
* Correct hyphenations in comments and assert messagesAlp Toker2013-12-052-4/+4
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities in nearby lines. llvm-svn: 196466
* Correct a user-visible static analyzer message typoAlp Toker2013-12-021-2/+2
| | | | llvm-svn: 196062
* Remove a whole lot of unused variablesAlp Toker2013-11-274-5/+1
| | | | | | | There are about 30 removed in this patch, generated by a new FixIt I haven't got round to submitting yet. llvm-svn: 195814
* Remove 'DistinctSpellings' support from Attr.td and change its only user toRichard Smith2013-11-271-9/+9
| | | | | | | | look at the attribute spelling instead. The 'ownership_*' attributes should probably be split into separate *Attr classes, but that's more than I wanted to do here. llvm-svn: 195805
OpenPOWER on IntegriCloud