Reid Kleckner
0626919015
Fix nullptr crash in -Wthread-safety-beta
...
llvm-svn: 252107
2015-11-05 00:24:01 +00:00
DeLesley Hutchins
2b504dce14
Thread Safety Analysis: allow capability attribute on unions.
...
llvm-svn: 248805
2015-09-29 16:24:18 +00:00
DeLesley Hutchins
dc0541f12f
Thread Safety Analysis: fix before/after checks so that they work on global
...
variables as well member variables.
llvm-svn: 248803
2015-09-29 15:25:51 +00:00
DeLesley Hutchins
445a31cd4b
Thread safety analysis: the NO_THREAD_SAFETY_ANALYSIS attribute will now
...
disable checking of arguments to the function, which is done by
-Wthread-safety-reference.
llvm-svn: 246806
2015-09-03 21:14:22 +00:00
DeLesley Hutchins
3c355aa24d
Thread Safety Analysis: support adopting of locks, as implemented in
...
std::lock_guard. If EXCLUSIVE_LOCKS_REQUIRED is placed on the constructor of
a SCOPED_LOCKABLE class, then that constructor is assumed to adopt the lock;
e.g. the lock must be held on construction, and will be released on destruction.
llvm-svn: 228194
2015-02-04 21:16:17 +00:00
DeLesley Hutchins
ab1dc2d54d
Thread Safety Analysis: add support for before/after annotations on mutexes.
...
These checks detect potential deadlocks caused by inconsistent lock
ordering. The checks are implemented under the -Wthread-safety-beta flag.
This patch also replaces calls to getAttrs() with calls to attrs() throughout
ThreadSafety.cpp, which fixes the earlier issue that cause assert failures.
llvm-svn: 228051
2015-02-03 22:11:04 +00:00
Reid Kleckner
6c5e36ae3b
Revert "Thread Safety Analysis: add support for before/after annotations on mutexes."
...
This reverts r227997, as well as r228009. It does not pass check-clang
for me locally on Linux.
llvm-svn: 228020
2015-02-03 19:51:16 +00:00
DeLesley Hutchins
4980df623f
Thread Safety Analysis: add support for before/after annotations on mutexes.
...
These checks detect potential deadlocks caused by inconsistent lock
ordering. The checks are implemented under the -Wthread-safety-beta flag.
llvm-svn: 227997
2015-02-03 18:17:48 +00:00
DeLesley Hutchins
c60dc2cfb9
Thread Safety Analysis: add new warning flag, -Wthread-safety-reference, which
...
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
2014-09-18 23:02:26 +00:00
Ed Schouten
ca98874943
Allow a scoped lockable object to acquire/release multiple locks.
...
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
2014-09-03 06:00:11 +00:00
DeLesley Hutchins
4133b13bd2
Thread Safety Analysis: fix to improve handling of references to guarded
...
data members and range based for loops.
llvm-svn: 215671
2014-08-14 19:17:06 +00:00
DeLesley Hutchins
3efd0495a0
Thread Safety Analysis: add a -Wthread-safety-negative flag that warns whenever
...
a mutex is acquired, but corresponding mutex is not provably not-held. This
is based on the earlier negative requirements patch.
llvm-svn: 214789
2014-08-04 22:13:06 +00:00
DeLesley Hutchins
4266522ab9
Thread safety analysis: Add support for negative requirements, which are
...
capability expressions of the form !expr, and denote a capability that must
not be held.
llvm-svn: 214725
2014-08-04 16:10:59 +00:00
DeLesley Hutchins
ea1f83385f
Thread Safety Analysis: Replace the old and broken SExpr with the new
...
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
2014-07-28 15:57:27 +00:00
Aaron Ballman
e044904301
Updating the capability attribute diagnostics to be more capability-neutral. 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
2014-04-01 21:43:23 +00:00
DeLesley Hutchins
d13c872187
Thread Safety Analysis: new test case for lambdas
...
llvm-svn: 203720
2014-03-12 21:33:47 +00:00
DeLesley Hutchins
8a7117d4c8
Thread safety analysis: handle duplicate assert_lock attributes.
...
llvm-svn: 199949
2014-01-23 22:35:26 +00:00
Aaron Ballman
553e68118f
Removing some unneeded code, and a diagnostic that was obsoleted. The type has already been determined to be a ValueDecl by virtue of the attribute subjects.
...
Added some test case coverage as well.
llvm-svn: 198046
2013-12-26 14:54:11 +00:00
DeLesley Hutchins
39b804f8a4
Thread safety analysis: fix ICE due to missing null check on dyn_cast.
...
llvm-svn: 195777
2013-11-26 19:45:21 +00:00
DeLesley Hutchins
e73d6b605c
Thread-safety analysis: check guarded_by and pt_guarded_by on array access.
...
Currently supported only with -Wthread-safety-beta.
llvm-svn: 194275
2013-11-08 19:42:01 +00:00
DeLesley Hutchins
05b7b37021
Thread safety analysis: minor bugfix to smart pointer handling, and expanded
...
test case.
llvm-svn: 194157
2013-11-06 18:40:01 +00:00
DeLesley Hutchins
5ede5cc9ba
Thread safety analysis: check pt_guarded_by attribute when calling -> and *
...
on smart pointers. -Wthread-safety-beta only.
llvm-svn: 194103
2013-11-05 23:09:56 +00:00
DeLesley Hutchins
d40542213c
Thread safety analysis: new test case
...
llvm-svn: 188571
2013-08-16 18:28:00 +00:00
DeLesley Hutchins
9f5193cf61
Thread Safety Analysis: fix bug when using TryLock with && and || expressions.
...
llvm-svn: 188505
2013-08-15 23:06:33 +00:00
DeLesley Hutchins
b682431775
Thread safety analysis: add two new attributes to the thread safety analysis:
...
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
2013-05-17 23:02:59 +00:00
DeLesley Hutchins
fd374bb3dd
Thread safety analysis: turn on checking within lock and unlock functions.
...
These checks are enabled with the -Wthread-safety-beta flag.
llvm-svn: 179046
2013-04-08 20:11:11 +00:00
DeLesley Hutchins
eb849c6bd5
Thread safety analysis: make sure that expressions in attributes are parsed
...
in an unevaluated context.
llvm-svn: 174644
2013-02-07 19:01:07 +00:00
DeLesley Hutchins
9fa426a666
Thread-safety analysis: ignore edges from throw expressions in CFG.
...
llvm-svn: 172858
2013-01-18 22:15:45 +00:00
DeLesley Hutchins
0cfa1a5a1d
Thread-safety analysis: check member access on guarded non-primitive types.
...
llvm-svn: 169669
2012-12-08 03:46:30 +00:00
DeLesley Hutchins
f489d2b86c
Thread-safety analysis: check locks on method calls, operator=, and
...
copy constructors.
llvm-svn: 169350
2012-12-05 01:20:45 +00:00
DeLesley Hutchins
2d0881b577
Thread-safety analysis: support multiple thread-safety attributes on
...
declarations.
llvm-svn: 165826
2012-10-12 21:38:12 +00:00
DeLesley Hutchins
1fe885614d
Thread-safety analysis: allow attributes on constructors to refer to 'this'.
...
llvm-svn: 165339
2012-10-05 22:38:19 +00:00
DeLesley Hutchins
f39c0c2487
Fix template instantiation of attributes. More specifically, fix the case
...
where an attribute is attached to a forward declaration of a template function,
and refers to parameters of that declaration, but is then inherited by the
definition of that function. When the definition is instantiated, the
parameter references need to be remapped.
llvm-svn: 164710
2012-09-26 17:57:31 +00:00
DeLesley Hutchins
10958cae09
Thread-safety analysis: better handling of unreachable blocks. Fixes a bug
...
where a call to function marked 'noreturn' is followed by unreachable
implicit destructor calls.
llvm-svn: 164394
2012-09-21 17:57:00 +00:00
DeLesley Hutchins
fcb0ffa622
Thread-safety analysis: fix bug where shared trylock was treated
...
as exclusive.
llvm-svn: 164332
2012-09-20 23:14:43 +00:00
DeLesley Hutchins
b78aeed26e
Thread safety analysis: properly canonicalize calls to virtual methods within
...
lock expressions.
llvm-svn: 164324
2012-09-20 22:18:02 +00:00
DeLesley Hutchins
132f8f6959
Thread-safety analysis: Fix warning when EXCLUSIVE_LOCKS_REQUIRED
...
is placed on a function that has no path to the exit block.
llvm-svn: 164244
2012-09-19 19:49:40 +00:00
DeLesley Hutchins
a15e1b4f63
Thread-safety analysis: fix ICE when EXCLUSIVE_LOCKS_REQUIRED or
...
LOCKS_EXCLUDED is used on a method with a name that is is not a simple
identifier.
llvm-svn: 164242
2012-09-19 19:18:29 +00:00
DeLesley Hutchins
138568b60a
Thread-safety analysis: fix bug in expression matching code.
...
llvm-svn: 163656
2012-09-11 23:04:49 +00:00
DeLesley Hutchins
781fe380c3
Thread safety analysis: fix bug related to lock_returned attribute
...
on templates.
llvm-svn: 163642
2012-09-11 18:27:46 +00:00
DeLesley Hutchins
5ff1644e62
Thread-safety analysis: differentiate between two forms of analysis; a precise
...
analysis that may give false positives because it is confused by aliasing, and
a less precise analysis that has fewer false positives, but may have false
negatives. The more precise warnings are enabled by -Wthread-safety-precise.
An additional note clarify the warnings in the precise case.
llvm-svn: 163537
2012-09-10 19:58:23 +00:00
Chad Rosier
ea3157f1e4
Whitespace.
...
llvm-svn: 163404
2012-09-07 18:46:57 +00:00
DeLesley Hutchins
a5a00e830a
Thread-safety analysis: Add support for selectively turning off warnings
...
within part of a particular method.
llvm-svn: 163397
2012-09-07 17:34:53 +00:00
DeLesley Hutchins
93b1b031c1
Thread-safety analysis: bugfix for case where a trylock occurs in an
...
expression involving temporaries.
llvm-svn: 163237
2012-09-05 20:01:16 +00:00
DeLesley Hutchins
f5cf7903d9
Thread-safety analysis: fix handling of LOCK_RETURNED attribute so that the
...
latest definition of a function is always used when computing lock expressions.
llvm-svn: 163028
2012-08-31 22:09:53 +00:00
DeLesley Hutchins
3c3d57bc16
Thread-safety analysis: fix handling of string constants in mutex
...
expressions, which should be ignored right now.
llvm-svn: 163026
2012-08-31 21:57:32 +00:00
DeLesley Hutchins
0c90c2bc4b
Thread-safety-analysis: adds existential quantification over lock
...
expressions. The syntax &MyClass::mutex is interpreted as a
pattern that matches m->mutex for any object m of type MyClass.
llvm-svn: 161691
2012-08-10 20:29:46 +00:00
DeLesley Hutchins
9b1d72f3e3
Thread safety analysis: refactor to support more sophisticated handling
...
of expressions, and better error messages.
llvm-svn: 161690
2012-08-10 20:19:55 +00:00
Sylvestre Ledru
a5202660fb
Fix some minor typos
...
llvm-svn: 161036
2012-07-31 06:56:50 +00:00
DeLesley Hutchins
868830f727
Thread safety analysis: impove handling of trylock expressions.
...
llvm-svn: 160018
2012-07-10 21:47:55 +00:00