Aaron Ballman
df115d9bf3
The release_capability, release_shared_capability and release_generic_capability functions are now functionally distinct for capability analysis. The unlock_function attribute maps directly to release_generic_capability.
...
llvm-svn: 204469
2014-03-21 14:48:48 +00:00
Aaron Ballman
18d85aed39
Replacing the exclusive_lock_function, shared_lock_function and 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
2014-03-20 16:02:49 +00:00
DeLesley Hutchins
d1c9b37db9
Thread safety analysis: move smart pointer checks from -Wthread-safety-beta
...
to -Wthread-safety.
llvm-svn: 203510
2014-03-10 23:03:49 +00:00
Aaron Ballman
be22bcb180
[C++11] Replacing DeclBase iterators specific_attr_begin() and specific_attr_end() with iterator_range specific_attrs(). Updating all of the usages of the iterators with range-based for loops.
...
llvm-svn: 203474
2014-03-10 17:08:28 +00:00
Aaron Ballman
69bb592ad1
Based on usage, the NamedDecl is always set when constructing a 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
2014-03-06 19:37:24 +00:00
Aaron Ballman
19842c437a
Refactored to use a simple helper function that wraps the logic of creating an SExprNode and returning the position in which it was inserted.
...
No functional change intended.
llvm-svn: 203148
2014-03-06 19:25:11 +00:00
Aaron Ballman
cea2609b59
Very minor simplification and typo correction; no functional changes intended.
...
llvm-svn: 203144
2014-03-06 19:10:16 +00:00
Aaron Ballman
efe348ec44
DeLesley Hutchins (who wrote the original thread-safety attribute 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
2014-02-18 17:36:50 +00:00
Aaron Ballman
ee58e6d6d2
Switching getAttrs calls over to using a specific_attr_iterator. No functional changes intended.
...
llvm-svn: 197681
2013-12-19 15:35:31 +00:00
Aaron Ballman
9ead1243a5
Replacing calls to getAttr with calls to hasAttr for clarity. No functional change intended -- this only replaces Boolean uses of getAttr.
...
llvm-svn: 197648
2013-12-19 02:39:40 +00:00
Alp Toker
f6a24ce40f
Fix a tranche of comment, test and doc typos
...
llvm-svn: 196510
2013-12-05 16:25:25 +00:00
Alp Toker
d473363876
Correct hyphenations in comments and assert messages
...
This patch tries to avoid unrelated changes other than fixing a few
hyphen-related ambiguities in nearby lines.
llvm-svn: 196466
2013-12-05 04:47:09 +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
Rafael Espindola
7b56f6c3c2
Simplify some implementations of get*Decl.
...
* 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
2013-10-19 16:55:03 +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
16b4ff5c4d
Thread safety analysis: move warnings within lock/unlock functions out of beta.
...
llvm-svn: 188465
2013-08-15 15:31:25 +00:00
Aaron Ballman
fcd5b7e76e
Updating a link in the comments; no functional change.
...
llvm-svn: 185013
2013-06-26 19:17:19 +00:00
DeLesley Hutchins
3b2c66bbda
Thread safety analysis: fix use after free bug reported by Evgeniy Stepanov.
...
llvm-svn: 182305
2013-05-20 17:57:55 +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
c105ba19e9
Thread safety analysis: Turn on checking for non-scalar types by default.
...
These were previously enabled as a "beta" feature, but they have now been
extensively tested.
llvm-svn: 178478
2013-04-01 17:47:37 +00:00
David Blaikie
00be69ab5c
Remove the CFGElement "Invalid" state.
...
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
2013-02-23 00:29:34 +00:00
David Blaikie
2a01f5d426
Replace CFGElement llvm::cast support to be well-defined.
...
See r175462 for another example/more details.
llvm-svn: 175796
2013-02-21 20:58:29 +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
Dmitri Gribenko
f857950d39
Remove useless 'llvm::' qualifier from names like StringRef and others that are
...
brought into 'clang' namespace by clang/Basic/LLVM.h
llvm-svn: 172323
2013-01-12 19:30:44 +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
5df82f2155
Thread Safety Analysis: refactor to make more methods accept const pointers,
...
adjust checkAccess. No change in functionality.
llvm-svn: 169348
2012-12-05 00:52:33 +00:00
Chandler Carruth
3a02247dc9
Sort all of Clang's files under 'lib', and fix up the broken headers
...
uncovered.
This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.
I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.
llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Benjamin Kramer
ea70eb30a0
Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't pull in all the generated Attr code.
...
Required to pull some functions out of line, but this shouldn't have a perf impact.
No functionality change.
llvm-svn: 169092
2012-12-01 15:09:41 +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
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
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
37a8563f36
Ampersand goes with identifier.
...
llvm-svn: 163410
2012-09-07 19:49:55 +00:00
Chad Rosier
78af00f675
Bring buildbots back. Fix scoping issue and coding style from r163397.
...
llvm-svn: 163403
2012-09-07 18:44:15 +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
Roman Divacky
e637711ae0
Dont cast away const needlessly. Found by gcc48 -Wcast-qual.
...
llvm-svn: 163325
2012-09-06 15:59:27 +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
Ted Kremenek
78094caa56
Fix an assortment of doxygen comment issues found by -Wdocumentation.
...
llvm-svn: 162412
2012-08-22 23:50:41 +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