Commit Graph

158 Commits

Author SHA1 Message Date
Aaron Ballman b51314cc3e Replacing some manual iterations with standard algorithms. No functional changes intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208783 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-14 15:01:43 +00:00
Aaron Ballman 9b6eaeef4c Formatting and style changes; no functional changes intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208774 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-14 13:03:55 +00:00
Aaron Ballman 43f465ff94 Amending r208439 to remove buildLExpr; this code isn't strictly required yet, and fixes a dead code warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208440 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-09 18:44:48 +00:00
Aaron Ballman b8f956e09a Add the ability to use logical expressions for capability attributes. This 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208439 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-09 18:26:23 +00:00
Nico Weber e4b7fc5455 Remove unused typedef found by gcc's -Wunused-local-typedefs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207870 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-02 21:22:21 +00:00
Aaron Ballman 03ebcc8297 Updated the attribute tablegen emitter for variadic arguments to emit a range accessor in addition to the iterators. Updated code using iterators to use range-based for loops.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207837 91177308-0d34-0410-b5e6-96231b3b80d8
2014-05-02 13:35:42 +00:00
Aaron Ballman a6bf8b86f4 Updating to use more range-based for loops, nullptr and auto. No functional changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206590 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-18 13:13:15 +00:00
Aaron Ballman 0904a54d07 Making some public members into private members. This also introduces a bit more const-correctness, and now uses some range-based for loops. No functional changes intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206503 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-17 21:44:08 +00:00
DeLesley Hutchins b622f9d076 Thread Safety Analysis: reorganized SExpr header files. No change in
functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205936 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-09 22:39:43 +00:00
DeLesley Hutchins 745d3c96e8 Thread Safety Analysis: update to internal SExpr handling.
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205728 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-07 18:09:54 +00:00
Aaron Ballman bde32e097d 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."
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205359 91177308-0d34-0410-b5e6-96231b3b80d8
2014-04-01 21:43:23 +00:00
Aaron Ballman 4ae1fe1225 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204469 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-21 14:48:48 +00:00
Aaron Ballman 18d907edb4 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204350 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-20 16:02:49 +00:00
DeLesley Hutchins d4811afb06 Thread safety analysis: move smart pointer checks from -Wthread-safety-beta
to -Wthread-safety.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203510 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-10 23:03:49 +00:00
Aaron Ballman 15fd658d17 [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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203474 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-10 17:08:28 +00:00
Aaron Ballman bf4e0959ad 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203149 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 19:37:24 +00:00
Aaron Ballman 9251f8441b 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203148 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 19:25:11 +00:00
Aaron Ballman 43a9b3443b Very minor simplification and typo correction; no functional changes intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@203144 91177308-0d34-0410-b5e6-96231b3b80d8
2014-03-06 19:10:16 +00:00
Aaron Ballman 0894e59748 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@201585 91177308-0d34-0410-b5e6-96231b3b80d8
2014-02-18 17:36:50 +00:00
Aaron Ballman 341a6452c8 Switching getAttrs calls over to using a specific_attr_iterator. No functional changes intended.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197681 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-19 15:35:31 +00:00
Aaron Ballman 97915e5a02 Replacing calls to getAttr with calls to hasAttr for clarity. No functional change intended -- this only replaces Boolean uses of getAttr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197648 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-19 02:39:40 +00:00
Alp Toker 0fb7888788 Fix a tranche of comment, test and doc typos
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196510 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 16:25:25 +00:00
Alp Toker 2b01e1e26d 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196466 91177308-0d34-0410-b5e6-96231b3b80d8
2013-12-05 04:47:09 +00:00
DeLesley Hutchins 4702f162bf Thread safety analysis: fix ICE due to missing null check on dyn_cast.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195777 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-26 19:45:21 +00:00
DeLesley Hutchins f9495911c4 Thread-safety analysis: check guarded_by and pt_guarded_by on array access.
Currently supported only with -Wthread-safety-beta.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194275 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-08 19:42:01 +00:00
DeLesley Hutchins 9a2f84b2f0 Thread safety analysis: minor bugfix to smart pointer handling, and expanded
test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194157 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-06 18:40:01 +00:00
DeLesley Hutchins 43399fb0e7 Thread safety analysis: check pt_guarded_by attribute when calling -> and *
on smart pointers.  -Wthread-safety-beta only.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@194103 91177308-0d34-0410-b5e6-96231b3b80d8
2013-11-05 23:09:56 +00:00
Rafael Espindola 87bcee88d9 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193039 91177308-0d34-0410-b5e6-96231b3b80d8
2013-10-19 16:55:03 +00:00
DeLesley Hutchins 7336b9f8c0 Thread Safety Analysis: fix bug when using TryLock with && and || expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188505 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-15 23:06:33 +00:00
DeLesley Hutchins a44f03bced Thread safety analysis: move warnings within lock/unlock functions out of beta.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188465 91177308-0d34-0410-b5e6-96231b3b80d8
2013-08-15 15:31:25 +00:00
Aaron Ballman b96e74f79c Updating a link in the comments; no functional change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185013 91177308-0d34-0410-b5e6-96231b3b80d8
2013-06-26 19:17:19 +00:00
DeLesley Hutchins 451f8e4ed6 Thread safety analysis: fix use after free bug reported by Evgeniy Stepanov.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182305 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-20 17:57:55 +00:00
DeLesley Hutchins 5c6134fd09 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@182170 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-17 23:02:59 +00:00
DeLesley Hutchins 5696884053 Thread safety analysis: turn on checking within lock and unlock functions.
These checks are enabled with the -Wthread-safety-beta flag.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179046 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-08 20:11:11 +00:00
DeLesley Hutchins dd0a1f58a5 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178478 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-01 17:47:37 +00:00
David Blaikie b07805485c 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175938 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-23 00:29:34 +00:00
David Blaikie fdf6a279c9 Replace CFGElement llvm::cast support to be well-defined.
See r175462 for another example/more details.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175796 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-21 20:58:29 +00:00
DeLesley Hutchins 0ecc2e9ce8 Thread-safety analysis: ignore edges from throw expressions in CFG.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172858 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-18 22:15:45 +00:00
Dmitri Gribenko cfa88f8939 Remove useless 'llvm::' qualifier from names like StringRef and others that are
brought into 'clang' namespace by clang/Basic/LLVM.h


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172323 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-12 19:30:44 +00:00
DeLesley Hutchins 93699d23cd Thread-safety analysis: check member access on guarded non-primitive types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169669 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-08 03:46:30 +00:00
DeLesley Hutchins 91e2061763 Thread-safety analysis: check locks on method calls, operator=, and
copy constructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169350 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 01:20:45 +00:00
DeLesley Hutchins 47715cc201 Thread Safety Analysis: refactor to make more methods accept const pointers,
adjust checkAccess.  No change in functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169348 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-05 00:52:33 +00:00
Chandler Carruth 55fc873017 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169237 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-04 09:13:33 +00:00
Benjamin Kramer 2fa67efeaf 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169092 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-01 15:09:41 +00:00
DeLesley Hutchins ef2388b10c Thread-safety analysis: allow attributes on constructors to refer to 'this'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165339 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-05 22:38:19 +00:00
DeLesley Hutchins d2f3882991 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164394 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-21 17:57:00 +00:00
DeLesley Hutchins 60ff198a22 Thread-safety analysis: fix bug where shared trylock was treated
as exclusive.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164332 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-20 23:14:43 +00:00
DeLesley Hutchins 186af2de86 Thread safety analysis: properly canonicalize calls to virtual methods within
lock expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164324 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-20 22:18:02 +00:00
DeLesley Hutchins 2a237e03c4 Thread-safety analysis: Fix warning when EXCLUSIVE_LOCKS_REQUIRED
is placed on a function that has no path to the exit block.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164244 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-19 19:49:40 +00:00
DeLesley Hutchins 5b280f2835 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164242 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-19 19:18:29 +00:00
DeLesley Hutchins f9ee0bacd2 Thread-safety analysis: fix bug in expression matching code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163656 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 23:04:49 +00:00
DeLesley Hutchins 3f0ec52097 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163537 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-10 19:58:23 +00:00
Chad Rosier 589190b322 Ampersand goes with identifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163410 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-07 19:49:55 +00:00
Chad Rosier 2de4770ec0 Bring buildbots back. Fix scoping issue and coding style from r163397.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163403 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-07 18:44:15 +00:00
DeLesley Hutchins 0b4db3e08a Thread-safety analysis: Add support for selectively turning off warnings
within part of a particular method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163397 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-07 17:34:53 +00:00
Roman Divacky 31ba613537 Dont cast away const needlessly. Found by gcc48 -Wcast-qual.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163325 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-06 15:59:27 +00:00
DeLesley Hutchins fd0f11ccd5 Thread-safety analysis: bugfix for case where a trylock occurs in an
expression involving temporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163237 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-05 20:01:16 +00:00
DeLesley Hutchins 5408153e91 Thread-safety analysis: fix handling of LOCK_RETURNED attribute so that the
latest definition of a function is always used when computing lock expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163028 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-31 22:09:53 +00:00
DeLesley Hutchins 4e4c15765d Thread-safety analysis: fix handling of string constants in mutex
expressions, which should be ignored right now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163026 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-31 21:57:32 +00:00
Ted Kremenek ad0fe03b89 Fix an assortment of doxygen comment issues found by -Wdocumentation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162412 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-22 23:50:41 +00:00
DeLesley Hutchins ee2f032fe0 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161691 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 20:29:46 +00:00
DeLesley Hutchins a74b715cdc Thread safety analysis: refactor to support more sophisticated handling
of expressions, and better error messages.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161690 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 20:19:55 +00:00
DeLesley Hutchins a1fa47139d Refactor thread safety analysis to use a different data structure
to track locksets.  This is in preparation for further changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161680 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-10 18:39:05 +00:00
Sylvestre Ledru bed28ac1d1 Fix a typo (the the => the)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160622 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-23 08:59:39 +00:00
DeLesley Hutchins 1310611706 Thread safety analysis: impove handling of trylock expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160018 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-10 21:47:55 +00:00
DeLesley Hutchins 5381c05f51 Thread-safety analysis: eliminate false positives in case where the definition
duplicates attributes on the declaration.  Also eliminates a false negative in
ReleasableMutexLock.  Fixing this bug required some refactoring.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159780 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-05 21:16:29 +00:00
DeLesley Hutchins 96fac6a7fe Thread safety analysis: improve handling of smart pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159679 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-03 19:47:18 +00:00
DeLesley Hutchins 9d6e7f3e12 Thread Safety Analysis: handle expressions involving temporaries,
e.g. ExprWithCleanups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159674 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-03 18:25:56 +00:00
DeLesley Hutchins bbe334142b Thread safety analysis: fixed bug that occurs when very silly people
use scoped_lockable without putting unlock_function on the
destructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159609 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02 22:26:29 +00:00
DeLesley Hutchins 879a4334e4 Thread safety analysis: fixed incorrect error message at the end of a locks_required function.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159607 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02 22:16:54 +00:00
DeLesley Hutchins c36eda1113 Thread safety analysis: don't warn in case of duplicate annotation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159606 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02 22:12:12 +00:00
DeLesley Hutchins 76f0a6e9bc Thread Safety Analysis: turn off checking within trylock functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159601 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-02 21:59:24 +00:00
DeLesley Hutchins c99a5d820e Thread safety analysis: support release() function on scoped
lockable objects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159387 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-28 22:42:48 +00:00
DeLesley Hutchins f63797c741 Thread safety analysis: implement lock_returned attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159152 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-25 18:33:18 +00:00
DeLesley Hutchins 0da4414f3d Thread safety analysis: fixes a bug in which locksets are not handled
properly if there is a join point in the control flow graph that involves
a trylock.  Also changes the source locations of some warnings to be
more consistent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159008 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-22 17:07:28 +00:00
DeLesley Hutchins 54c350a67b Refactor the thread safety analysis so that it is easier to do
path-sensitive analysis like handling of trylock expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155137 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-19 16:48:43 +00:00
John McCall f4b88a4590 Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr to
track whether the referenced declaration comes from an enclosing
local context.  I'm amenable to suggestions about the exact meaning
of this bit.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152491 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 09:33:50 +00:00
DeLesley Hutchins 0d95dfcc0e Thread safety analysis: expand set of expressions that can be used to denote locks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151956 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 23:36:05 +00:00
DeLesley Hutchins 2a35be803c Thread safety analysis: handle CFG blocks which call functions marked as noreturn.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151944 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 22:02:58 +00:00
DeLesley Hutchins 2f13bec63b Thread-safety analysis: Disable checking inside constructors, destructors, lock, and unlock functions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150701 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-16 17:13:43 +00:00
DeLesley Hutchins 4bda3eca13 Thread-Safety: added support for 'this' as a lock expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150700 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-16 17:03:24 +00:00
Richard Smith 2e5156274b Thread safety analysis:
* When we detect that a CFG block has inconsistent lock sets, point the
   diagnostic at the location where we found the inconsistency, and point a note
   at somewhere the inconsistently-locked mutex was locked.
 * Fix the wording of the normal (non-loop, non-end-of-function) case of this
   diagnostic to not suggest that the mutex is going out of scope.
 * Fix the diagnostic emission code to keep a warning and its note together when
   sorting the diagnostics into source location order.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149669 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-03 04:45:26 +00:00
Richard Smith aacde7174a Thread safety analysis: at a CFG join point between a block terminating in a
'continue' and another block, prefer the lockset from the other block, and
diagnose the 'continue' block as being the end of a loop.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149666 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-03 03:30:07 +00:00
DeLesley Hutchins e03b2b3ca9 Handle thread safety attributes on functions with separate definitions and declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148599 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-20 23:24:41 +00:00
DeLesley Hutchins b4fa418a72 Thread safety analysis: added support for trylock attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147672 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 19:16:50 +00:00
DeLesley Hutchins b37d2b5c08 Added LocalVariableMap
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147670 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-06 18:36:09 +00:00
DeLesley Hutchins df49782c54 Support for thread safety attributes on functions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147331 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-29 00:56:48 +00:00
DeLesley Hutchins 1fa3c0682a This patch extends thread safety analysis with support for the scoped_lockable attribute.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146174 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-08 20:23:06 +00:00
Ted Kremenek 1d26f48dc2 Rename AnalysisContext to AnalysisDeclContext. Not only is this name more accurate, but it frees up the name AnalysisContext for other uses.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142782 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-24 01:32:45 +00:00
Ted Kremenek 439ed16566 Refactor ThreadSafety to use PostOrderCFGView instead of its own copy (of TopologicallySortedCFG).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142714 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-22 02:14:27 +00:00
DeLesley Hutchins 6db51f707e Added support for thread safety attributes on destructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142685 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21 20:51:27 +00:00
DeLesley Hutchins f1ac637021 Thread safety analysis refactoring: invalid lock expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142666 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21 18:10:14 +00:00
DeLesley Hutchins e0eaa8531f Thread safety analysis: add support for attributes on constructors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142665 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21 18:06:53 +00:00
DeLesley Hutchins a60448d6df Refactoring and code cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142654 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-21 16:14:33 +00:00
DeLesley Hutchins 8121639910 Substitute for arguments in method calls -- functionality
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142267 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 21:38:02 +00:00
DeLesley Hutchins 9f80a97408 Substitute for arguments in method calls -- refactoring
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142260 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 21:33:35 +00:00
DeLesley Hutchins 9859ea07b5 Test commit
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140149 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-20 17:25:59 +00:00
Caitlin Sadowski 1748b12566 Thread safety: Adding FIXMEs and a couple cleanups
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139894 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-16 00:35:54 +00:00
Caitlin Sadowski cb96751b25 Thread safety: completeing the implementation of shared/exclusive locks required attributes
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139804 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-15 17:43:08 +00:00
Caitlin Sadowski 4e4bc75d35 Thread safety: refactoring various out of scope warnings to use the same inteface. This eliminates a lot of unnecessary duplicated code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139801 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-15 17:25:19 +00:00