Richard Smith
4baaa5ab52
DR616, and part of P0135R1: member access (or pointer-to-member access) on a
...
temporary produces an xvalue, not a prvalue. Support this by materializing the
temporary prior to performing the member access.
llvm-svn: 288563
2016-12-03 01:14:32 +00:00
Benjamin Kramer
33e9760376
Remove move constructors that are identical to the generated default move ctor.
...
llvm-svn: 284856
2016-10-21 18:55:07 +00:00
Mehdi Amini
9670f847b8
[NFC] Header cleanup
...
Summary: Removed unused headers, replaced some headers with forward class declarations
Patch by: Eugene <claprix@yandex.ru>
Differential Revision: https://reviews.llvm.org/D20100
llvm-svn: 275882
2016-07-18 19:02:11 +00:00
Reid Kleckner
19ff5602da
Thread Safety Analysis: Fix DenseMap iterator invalidation UAF
...
Rather than storing BeforeInfo in the DenseMap by value, this stores a
unique_ptr to it, so that we can keep a pointer to it live across
subsequent DenseMap insertions.
This change also removes the unique_ptr wrapper around BeforeVect
because now we're indirecting at a higher level.
llvm-svn: 253694
2015-11-20 19:08:30 +00:00
Angel Garcia Gomez
637d1e6694
Roll-back r250822.
...
Summary: It breaks the build for the ASTMatchers
Subscribers: klimek, cfe-commits
Differential Revision: http://reviews.llvm.org/D13893
llvm-svn: 250827
2015-10-20 13:23:58 +00:00
Angel Garcia Gomez
b5250d3448
Apply modernize-use-default to clang.
...
Summary: Replace empty bodies of default constructors and destructors with '= default'.
Reviewers: bkramer, klimek
Subscribers: klimek, alexfh, cfe-commits
Differential Revision: http://reviews.llvm.org/D13890
llvm-svn: 250822
2015-10-20 12:52:55 +00:00
Yaron Keren
ed1fe5d093
Replace double-negated !SourceLocation.isInvalid() with SourceLocation.isValid().
...
llvm-svn: 249228
2015-10-03 05:15:57 +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
Richard Trieu
a1877598aa
Take the non-reference type when constructing a dummy expression.
...
Otherwise, Expr will assert during construction with a reference type.
llvm-svn: 232425
2015-03-16 21:49:43 +00:00
Benjamin Kramer
66a97ee957
Hide away implementation details of the ThreadSafetyAnalysis in anonymous namespaces
...
NFC.
llvm-svn: 231653
2015-03-09 14:19:54 +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
dfa9032f64
Thread Safety Analysis: remove minor piece of unused code. No change in
...
functionality.
llvm-svn: 228176
2015-02-04 19:28: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
Reid Kleckner
e675575d1b
thread safety: Add move ctor to BeforeInfo to fix MSVC build
...
MSVC cannot infer move ctors yet.
llvm-svn: 228009
2015-02-03 19:04:26 +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
Chandler Carruth
0d9593ddec
[cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.py
...
Sorry for the noise, I managed to miss a bunch of recent regressions of
include orderings here. This should actually sort all the includes for
Clang. Again, no functionality changed, this is just a mechanical
cleanup that I try to run periodically to keep the #include lines as
regular as possible across the project.
llvm-svn: 225979
2015-01-14 11:29:14 +00:00
DeLesley Hutchins
6d41f38c74
Thread Safety Analysis: move warnings on range-based for loops out of beta
...
and into -Wthread-safety.
llvm-svn: 221410
2014-11-05 23:09:28 +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
Aaron Ballman
b00885898e
Adding const-qualifiers to auto declarations. NFC.
...
llvm-svn: 215704
2014-08-15 12:29:39 +00:00
DeLesley Hutchins
eb0ea5f40a
Thread safety analysis: add -Wthread-safety-verbose flag, which adds additional notes that are helpful when compiling statistics on thread safety warnings.
...
llvm-svn: 215677
2014-08-14 21:40:15 +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
NAKAMURA Takumi
13a4f76d51
ThreadSafety.cpp: Prune bogus \param(s). [-Wdocumentation]
...
llvm-svn: 214796
2014-08-04 22:48:46 +00:00
NAKAMURA Takumi
e9882cf315
ThreadSafetyAnalysis: Fix annotations in class members. [-Wdocumentation]
...
llvm-svn: 214795
2014-08-04 22:48:36 +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
Craig Topper
2554294321
[C++11] Use 'nullptr'. Analysis edition.
...
llvm-svn: 209191
2014-05-20 04:30:07 +00:00
Aaron Ballman
9ee54d119c
Converting some for loops to use range-based for loops. No functional changes intended.
...
llvm-svn: 208810
2014-05-14 20:42:13 +00:00
Aaron Ballman
59a72b93a2
Amending r208783 based on a suggestion by David Blaikie.
...
llvm-svn: 208800
2014-05-14 18:32:59 +00:00
Aaron Ballman
42f9a8a7f9
Replacing some manual iterations with standard algorithms. No functional changes intended.
...
llvm-svn: 208783
2014-05-14 15:01:43 +00:00
Aaron Ballman
2f3fc6badd
Formatting and style changes; no functional changes intended.
...
llvm-svn: 208774
2014-05-14 13:03:55 +00:00
Aaron Ballman
0c6a14ca82
Amending r208439 to remove buildLExpr; this code isn't strictly required yet, and fixes a dead code warning.
...
llvm-svn: 208440
2014-05-09 18:44:48 +00:00
Aaron Ballman
7c192b452f
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.
llvm-svn: 208439
2014-05-09 18:26:23 +00:00
Nico Weber
b0f9e4ace7
Remove unused typedef found by gcc's -Wunused-local-typedefs.
...
llvm-svn: 207870
2014-05-02 21:22:21 +00:00
Aaron Ballman
a82eaa70f1
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.
...
llvm-svn: 207837
2014-05-02 13:35:42 +00:00
Aaron Ballman
0491afaf5f
Updating to use more range-based for loops, nullptr and auto. No functional changes.
...
llvm-svn: 206590
2014-04-18 13:13:15 +00:00
Aaron Ballman
e80bfcd048
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.
...
llvm-svn: 206503
2014-04-17 21:44:08 +00:00
DeLesley Hutchins
7e615c2f65
Thread Safety Analysis: reorganized SExpr header files. No change in
...
functionality.
llvm-svn: 205936
2014-04-09 22:39:43 +00:00
DeLesley Hutchins
b2213910de
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.
llvm-svn: 205728
2014-04-07 18:09:54 +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
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