summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/ThreadSafety.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Thread Safety Analysis: move warnings on range-based for loops out of betaDeLesley Hutchins2014-11-051-11/+9
| | | | | | and into -Wthread-safety. llvm-svn: 221410
* Thread Safety Analysis: add new warning flag, -Wthread-safety-reference, whichDeLesley Hutchins2014-09-181-16/+68
| | | | | | | | warns when a guarded variable is passed by reference as a function argument. This is released as a separate warning flag, because it could potentially break existing code that uses thread safety analysis. llvm-svn: 218087
* Allow a scoped lockable object to acquire/release multiple locks.Ed Schouten2014-09-031-125/+162
| | | | | | | | | | | | | | | | | Scoped lockable objects (mutex guards) are implemented as if it is a lock itself that is acquired upon construction and unlocked upon destruction. As it if course needs to be used to actually lock down something else (a mutex), it keeps track of this knowledge through its underlying mutex field in its FactEntry. The problem with this approach is that this only allows us to lock down a single mutex, so extend the code to use a vector of underlying mutexes. This, however, makes the code a bit more complex than necessary, so subclass FactEntry into LockableFactEntry and ScopedLockableFactEntry and move all the logic that differs between regular locks and scoped lockables into member functions. llvm-svn: 217016
* Adding const-qualifiers to auto declarations. NFC.Aaron Ballman2014-08-151-3/+3
| | | | llvm-svn: 215704
* Thread safety analysis: add -Wthread-safety-verbose flag, which adds ↵DeLesley Hutchins2014-08-141-0/+5
| | | | | | additional notes that are helpful when compiling statistics on thread safety warnings. llvm-svn: 215677
* Thread Safety Analysis: fix to improve handling of references to guardedDeLesley Hutchins2014-08-141-20/+34
| | | | | | data members and range based for loops. llvm-svn: 215671
* ThreadSafety.cpp: Prune bogus \param(s). [-Wdocumentation]NAKAMURA Takumi2014-08-041-3/+0
| | | | llvm-svn: 214796
* ThreadSafetyAnalysis: Fix annotations in class members. [-Wdocumentation]NAKAMURA Takumi2014-08-041-5/+5
| | | | llvm-svn: 214795
* Thread Safety Analysis: add a -Wthread-safety-negative flag that warns wheneverDeLesley Hutchins2014-08-041-32/+70
| | | | | | | a mutex is acquired, but corresponding mutex is not provably not-held. This is based on the earlier negative requirements patch. llvm-svn: 214789
* Thread safety analysis: Add support for negative requirements, which areDeLesley Hutchins2014-08-041-268/+232
| | | | | | | capability expressions of the form !expr, and denote a capability that must not be held. llvm-svn: 214725
* Thread Safety Analysis: Replace the old and broken SExpr with the newDeLesley Hutchins2014-07-281-723/+168
| | | | | | | | til::SExpr. This is a large patch, with many small changes to pretty printing and expression lowering to make the new SExpr representation equivalent in functionality to the old. llvm-svn: 214089
* [C++11] Use 'nullptr'. Analysis edition.Craig Topper2014-05-201-38/+39
| | | | llvm-svn: 209191
* Converting some for loops to use range-based for loops. No functional ↵Aaron Ballman2014-05-141-23/+14
| | | | | | changes intended. llvm-svn: 208810
* Amending r208783 based on a suggestion by David Blaikie.Aaron Ballman2014-05-141-14/+12
| | | | llvm-svn: 208800
* Replacing some manual iterations with standard algorithms. No functional ↵Aaron Ballman2014-05-141-29/+22
| | | | | | changes intended. llvm-svn: 208783
* Formatting and style changes; no functional changes intended.Aaron Ballman2014-05-141-8/+7
| | | | llvm-svn: 208774
* Amending r208439 to remove buildLExpr; this code isn't strictly required ↵Aaron Ballman2014-05-091-46/+0
| | | | | | yet, and fixes a dead code warning. llvm-svn: 208440
* Add the ability to use logical expressions for capability attributes. This ↵Aaron Ballman2014-05-091-0/+47
| | | | | | | | | | is to allow requirements to be expressed not just in terms of lists, but in terms of logical expressions. Eg) void foo(void) __attribute__((requires_capability((FlightControl || Worker) && !Logger))); This is WIP code. llvm-svn: 208439
* Remove unused typedef found by gcc's -Wunused-local-typedefs.Nico Weber2014-05-021-2/+0
| | | | llvm-svn: 207870
* Updated the attribute tablegen emitter for variadic arguments to emit a ↵Aaron Ballman2014-05-021-18/+13
| | | | | | range accessor in addition to the iterators. Updated code using iterators to use range-based for loops. llvm-svn: 207837
* Updating to use more range-based for loops, nullptr and auto. No functional ↵Aaron Ballman2014-04-181-20/+14
| | | | | | changes. llvm-svn: 206590
* Making some public members into private members. This also introduces a bit ↵Aaron Ballman2014-04-171-16/+10
| | | | | | more const-correctness, and now uses some range-based for loops. No functional changes intended. llvm-svn: 206503
* Thread Safety Analysis: reorganized SExpr header files. No change inDeLesley Hutchins2014-04-091-0/+1
| | | | | | functionality. llvm-svn: 205936
* Thread Safety Analysis: update to internal SExpr handling.DeLesley Hutchins2014-04-071-8/+15
| | | | | | | | | | This patch is the first part of a significant refactoring that seeks to restore sanity to way thread safety analysis deals with capability expressions. The current patch merely provides an outline of the structure of the new system. It's not yet connected to the actual analysis, so there's no change in functionality. llvm-svn: 205728
* Updating the capability attribute diagnostics to be more capability-neutral. ↵Aaron Ballman2014-04-011-104/+176
| | | | | | Instead of using terminology such as "lock", "unlock" and "locked", the new terminology is "acquire", "release" and "held". Additionally, the capability attribute's name argument is now reported as part of the diagnostic, instead of hard coding as "mutex." llvm-svn: 205359
* The release_capability, release_shared_capability and ↵Aaron Ballman2014-03-211-27/+33
| | | | | | release_generic_capability functions are now functionally distinct for capability analysis. The unlock_function attribute maps directly to release_generic_capability. llvm-svn: 204469
* Replacing the exclusive_lock_function, shared_lock_function and ↵Aaron Ballman2014-03-201-24/+14
| | | | | | | | unlock_function attributes with the acquire_capability and release_capability attributes. The old spellings will continue to work, but the underlying semantic attributes have been replaced. Downgraded the capability diagnostics from error to warning to match the desired behavior, and updated the existing test cases. llvm-svn: 204350
* Thread safety analysis: move smart pointer checks from -Wthread-safety-betaDeLesley Hutchins2014-03-101-27/+19
| | | | | | to -Wthread-safety. llvm-svn: 203510
* [C++11] Replacing DeclBase iterators specific_attr_begin() and ↵Aaron Ballman2014-03-101-8/+4
| | | | | | specific_attr_end() with iterator_range specific_attrs(). Updating all of the usages of the iterators with range-based for loops. llvm-svn: 203474
* Based on usage, the NamedDecl is always set when constructing a ↵Aaron Ballman2014-03-061-6/+3
| | | | | | | | CallingContext, but none of the other optional parameters are. Removing the optional parameters, and making the NamedDecl required. No functional changes intended. llvm-svn: 203149
* Refactored to use a simple helper function that wraps the logic of creating ↵Aaron Ballman2014-03-061-26/+18
| | | | | | | | an SExprNode and returning the position in which it was inserted. No functional change intended. llvm-svn: 203148
* Very minor simplification and typo correction; no functional changes intended.Aaron Ballman2014-03-061-14/+3
| | | | llvm-svn: 203144
* DeLesley Hutchins (who wrote the original thread-safety attribute ↵Aaron Ballman2014-02-181-19/+8
| | | | | | | | | | | | | | | functionality) and I have agreed to start migrating from lock-specific terminology to "capability"-specific terminology. This opens the door for future threading-related analysis passes so that a common nomenclature can be used. The following attributes have been (silently) deprecated, with their replacements listed: lockable => capability exclusive_locks_required => requires_capability shared_locks_required => requires_shared_capability locks_excluded => requires_capability There are no functional changes intended. llvm-svn: 201585
* Switching getAttrs calls over to using a specific_attr_iterator. No ↵Aaron Ballman2013-12-191-8/+8
| | | | | | functional changes intended. llvm-svn: 197681
* Replacing calls to getAttr with calls to hasAttr for clarity. No functional ↵Aaron Ballman2013-12-191-4/+4
| | | | | | change intended -- this only replaces Boolean uses of getAttr. llvm-svn: 197648
* Fix a tranche of comment, test and doc typosAlp Toker2013-12-051-1/+1
| | | | llvm-svn: 196510
* Correct hyphenations in comments and assert messagesAlp Toker2013-12-051-1/+1
| | | | | | | This patch tries to avoid unrelated changes other than fixing a few hyphen-related ambiguities in nearby lines. llvm-svn: 196466
* Thread safety analysis: fix ICE due to missing null check on dyn_cast.DeLesley Hutchins2013-11-261-6/+9
| | | | llvm-svn: 195777
* Thread-safety analysis: check guarded_by and pt_guarded_by on array access.DeLesley Hutchins2013-11-081-2/+31
| | | | | | Currently supported only with -Wthread-safety-beta. llvm-svn: 194275
* Thread safety analysis: minor bugfix to smart pointer handling, and expandedDeLesley Hutchins2013-11-061-4/+5
| | | | | | test case. llvm-svn: 194157
* Thread safety analysis: check pt_guarded_by attribute when calling -> and *DeLesley Hutchins2013-11-051-0/+8
| | | | | | on smart pointers. -Wthread-safety-beta only. llvm-svn: 194103
* Simplify some implementations of get*Decl.Rafael Espindola2013-10-191-4/+2
| | | | | | | | | | * NamedDecl and CXXMethodDecl were missing getMostRecentDecl. * The const version can just forward to the non const. * getMostRecentDecl can use cast instead of cast_or_null. This then removes some casts from the callers. llvm-svn: 193039
* Thread Safety Analysis: fix bug when using TryLock with && and || expressions.DeLesley Hutchins2013-08-151-5/+11
| | | | llvm-svn: 188505
* Thread safety analysis: move warnings within lock/unlock functions out of beta.DeLesley Hutchins2013-08-151-6/+0
| | | | llvm-svn: 188465
* Updating a link in the comments; no functional change.Aaron Ballman2013-06-261-2/+2
| | | | llvm-svn: 185013
* Thread safety analysis: fix use after free bug reported by Evgeniy Stepanov.DeLesley Hutchins2013-05-201-7/+21
| | | | llvm-svn: 182305
* Thread safety analysis: add two new attributes to the thread safety analysis:DeLesley Hutchins2013-05-171-8/+41
| | | | | | | assert_exclusive_lock and assert_shared_lock. These attributes are used to mark functions that dynamically check (i.e. assert) that a lock is held. llvm-svn: 182170
* Thread safety analysis: turn on checking within lock and unlock functions.DeLesley Hutchins2013-04-081-10/+48
| | | | | | These checks are enabled with the -Wthread-safety-beta flag. llvm-svn: 179046
* Thread safety analysis: Turn on checking for non-scalar types by default.DeLesley Hutchins2013-04-011-49/+43
| | | | | | | These were previously enabled as a "beta" feature, but they have now been extensively tested. llvm-svn: 178478
* Remove the CFGElement "Invalid" state.David Blaikie2013-02-231-6/+6
| | | | | | | | | | | | | Use Optional<CFG*> where invalid states were needed previously. In the one case where that's not possible (beginAutomaticObjDtorsInsert) just use a dummy CFGAutomaticObjDtor. Thanks for the help from Jordan Rose & discussion/feedback from Ted Kremenek and Doug Gregor. Post commit code review feedback on r175796 by Ted Kremenek. llvm-svn: 175938
OpenPOWER on IntegriCloud