summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/ThreadSafety.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [CSA] [NFC] Move AnalysisContext.h to AnalysisDeclContext.hGeorge Karpenkov2017-09-061-1/+1
| | | | | | | | | | | | | | The implementation is in AnalysisDeclContext.cpp and the class is called AnalysisDeclContext. Making those match up has numerous benefits, including: - Easier jump from header to/from implementation. - Easily identify filename from class. Differential Revision: https://reviews.llvm.org/D37500 llvm-svn: 312671
* Reland "Thread Safety Analysis: fix assert_capability."Josh Gao2017-08-081-2/+17
| | | | | | | | | | | Delete the test that was broken by rL309725, and add it back in a follow up commit. Also, improve the tests a bit. Reviewers: delesley, aaron.ballman Differential Revision: https://reviews.llvm.org/D36237 llvm-svn: 310402
* Revert "Thread Safety Analysis: fix assert_capability."Josh Gao2017-08-011-17/+2
| | | | | | | | This reverts commit rL309725. Broke test/Sema/attr-capabilities.c. llvm-svn: 309731
* Thread Safety Analysis: fix assert_capability.Josh Gao2017-08-011-2/+17
| | | | | | | | | | | | | | | | Summary: Previously, the assert_capability attribute was completely ignored by thread safety analysis. Reviewers: delesley, rnk Reviewed By: delesley Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D36122 llvm-svn: 309725
* DR616, and part of P0135R1: member access (or pointer-to-member access) on aRichard Smith2016-12-031-1/+1
| | | | | | | temporary produces an xvalue, not a prvalue. Support this by materializing the temporary prior to performing the member access. llvm-svn: 288563
* Remove move constructors that are identical to the generated default move ctor.Benjamin Kramer2016-10-211-1/+1
| | | | llvm-svn: 284856
* [NFC] Header cleanupMehdi Amini2016-07-181-3/+1
| | | | | | | | | | 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
* Thread Safety Analysis: Fix DenseMap iterator invalidation UAFReid Kleckner2015-11-201-39/+36
| | | | | | | | | | | 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
* Roll-back r250822.Angel Garcia Gomez2015-10-201-2/+2
| | | | | | | | | | Summary: It breaks the build for the ASTMatchers Subscribers: klimek, cfe-commits Differential Revision: http://reviews.llvm.org/D13893 llvm-svn: 250827
* Apply modernize-use-default to clang.Angel Garcia Gomez2015-10-201-2/+2
| | | | | | | | | | | | 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
* Replace double-negated !SourceLocation.isInvalid() with ↵Yaron Keren2015-10-031-1/+1
| | | | | | SourceLocation.isValid(). llvm-svn: 249228
* Thread safety analysis: the NO_THREAD_SAFETY_ANALYSIS attribute will nowDeLesley Hutchins2015-09-031-25/+33
| | | | | | | disable checking of arguments to the function, which is done by -Wthread-safety-reference. llvm-svn: 246806
* Take the non-reference type when constructing a dummy expression.Richard Trieu2015-03-161-2/+2
| | | | | | Otherwise, Expr will assert during construction with a reference type. llvm-svn: 232425
* Hide away implementation details of the ThreadSafetyAnalysis in anonymous ↵Benjamin Kramer2015-03-091-27/+22
| | | | | | | | namespaces NFC. llvm-svn: 231653
* Thread Safety Analysis: support adopting of locks, as implemented inDeLesley Hutchins2015-02-041-11/+24
| | | | | | | | 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
* Thread Safety Analysis: remove minor piece of unused code. No change inDeLesley Hutchins2015-02-041-4/+0
| | | | | | functionality. llvm-svn: 228176
* Thread Safety Analysis: add support for before/after annotations on mutexes.DeLesley Hutchins2015-02-031-23/+220
| | | | | | | | | | 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
* Revert "Thread Safety Analysis: add support for before/after annotations on ↵Reid Kleckner2015-02-031-216/+17
| | | | | | | | | mutexes." This reverts r227997, as well as r228009. It does not pass check-clang for me locally on Linux. llvm-svn: 228020
* thread safety: Add move ctor to BeforeInfo to fix MSVC buildReid Kleckner2015-02-031-0/+2
| | | | | | MSVC cannot infer move ctors yet. llvm-svn: 228009
* Thread Safety Analysis: add support for before/after annotations on mutexes.DeLesley Hutchins2015-02-031-17/+214
| | | | | | | These checks detect potential deadlocks caused by inconsistent lock ordering. The checks are implemented under the -Wthread-safety-beta flag. llvm-svn: 227997
* [cleanup] Re-sort *all* #include lines with llvm/utils/sort_includes.pyChandler Carruth2015-01-141-1/+1
| | | | | | | | | | 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
* 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
OpenPOWER on IntegriCloud