summaryrefslogtreecommitdiff
path: root/lib/Analysis
Commit message (Collapse)AuthorAge
* Fix a crash in Retain Count checker error reportingAnna Zaks2014-06-13
| | | | | | | | | Fixes a crash in Retain Count checker error reporting logic by handing the allocation statement retrieval from a BlockEdge program point. Also added a simple CFG dump routine for debugging. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210960 91177308-0d34-0410-b5e6-96231b3b80d8
* PR19996: don't crash if -Wuninitialized sees a c++1y lambda init-capture.Richard Smith2014-06-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210615 91177308-0d34-0410-b5e6-96231b3b80d8
* Removing an "if (this == nullptr)" check from two print methods. The conditionRichard Trieu2014-06-09
| | | | | | | | will never be true in a well-defined context. The checking for null pointers has been moved into the caller logic so it does not rely on undefined behavior. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210498 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread Safety Analysis: implement review suggestions from Aaron Ballman.DeLesley Hutchins2014-05-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209847 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread Safety Analysis: update TIL traversal mechanism to allow arbitraryDeLesley Hutchins2014-05-28
| | | | | | local contexts. Also includes some minor refactoring. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209774 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix line endings.Nikola Smiljanic2014-05-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209727 91177308-0d34-0410-b5e6-96231b3b80d8
* Move the logic for testing for namespace std into one location. This check canRichard Trieu2014-05-28
| | | | | | | be performed by using Decl::isInStdNamespace or DeclContext::isStdNamespace git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209708 91177308-0d34-0410-b5e6-96231b3b80d8
* Make dead return statement detection more robust against changes in the CFG.Manuel Klimek2014-05-23
| | | | | | | | | | | | This change is a precondition to the proposed change to handle temporary dtors correctly. The idea is to explicitly search for the next return that doesn't have other paths into it (that is, if the current block is dead, the block containing the return must be dead, too). Thus, introducing non-control-flow block transitions will not break the logic. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209531 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a check for tautological bitwise comparisons to -Wtautological-compare.Jordan Rose2014-05-20
| | | | | | | | | | | This catches issues like: if ((x & 8) == 4) { ... } if ((x | 4) != 3) { ... } Patch by Anders Rönnholm! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209221 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Use 'nullptr'. Analysis edition.Craig Topper2014-05-20
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209191 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread Safety Analysis: add new node types to thread safety TIL.DeLesley Hutchins2014-05-15
| | | | | | This fills in a few missing gaps in functionality. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208830 91177308-0d34-0410-b5e6-96231b3b80d8
* Converting some for loops to use range-based for loops. No functional ↵Aaron Ballman2014-05-14
| | | | | | changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208810 91177308-0d34-0410-b5e6-96231b3b80d8
* Amending r208783 based on a suggestion by David Blaikie.Aaron Ballman2014-05-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208800 91177308-0d34-0410-b5e6-96231b3b80d8
* Replacing some manual iterations with standard algorithms. No functional ↵Aaron Ballman2014-05-14
| | | | | | changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208783 91177308-0d34-0410-b5e6-96231b3b80d8
* Formatting and style changes; no functional changes intended.Aaron Ballman2014-05-14
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208774 91177308-0d34-0410-b5e6-96231b3b80d8
* Amending r208439 to remove buildLExpr; this code isn't strictly required ↵Aaron Ballman2014-05-09
| | | | | | yet, and fixes a dead code warning. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208440 91177308-0d34-0410-b5e6-96231b3b80d8
* Add the ability to use logical expressions for capability attributes. This ↵Aaron Ballman2014-05-09
| | | | | | | | | | 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
* ThreadSafetyAnalysis: Don't crash when trying to analyze objc methods.Benjamin Kramer2014-05-09
| | | | | | | | | | | The thread safety analysis isn't very useful in ObjC (you can't annotate ObjC classes or methods) but we can still analyze the actual code and show violations in usage of C/C++ functions. Fixes PR19541, which does not use thread safety attributes but crashes with -Weverything. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208436 91177308-0d34-0410-b5e6-96231b3b80d8
* Explicitly keep track of temporaries during the consumed analysis.Manuel Klimek2014-05-08
| | | | | | | This makes the consumed analysis less dependent on the CFG layout and fixes a bug where we wouldn't warn on an unconsumed value. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@208300 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix handling of condition variables in the face of temp dtors.Manuel Klimek2014-05-05
| | | | | | | | The assignment needs to be before the destruction of the temporary. This patch calls out to addStmt, which invokes VisitDeclStmt, which has all the correct logic for handling temporaries. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207985 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove unused typedef found by gcc's -Wunused-local-typedefs.Nico Weber2014-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207870 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bad comment from r207573.Hans Wennborg2014-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207854 91177308-0d34-0410-b5e6-96231b3b80d8
* Updated the attribute tablegen emitter for variadic arguments to emit a ↵Aaron Ballman2014-05-02
| | | | | | 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
* Renaming the CallableState variadic attribute argument to be CallableStates. ↵Aaron Ballman2014-05-02
| | | | | | No functional changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207836 91177308-0d34-0410-b5e6-96231b3b80d8
* scanf analysis: handle scanlists that start with ^] (PR19559)Hans Wennborg2014-04-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207573 91177308-0d34-0410-b5e6-96231b3b80d8
* Renaming range-based for loop variables so they don't appear iterator-like.Aaron Ballman2014-04-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207422 91177308-0d34-0410-b5e6-96231b3b80d8
* [C++11] Converting to range-based for loops. No functional changes intended.Aaron Ballman2014-04-28
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207416 91177308-0d34-0410-b5e6-96231b3b80d8
* Replacing a naked pointer with a unique_ptr. No functional changes intended.Aaron Ballman2014-04-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206986 91177308-0d34-0410-b5e6-96231b3b80d8
* Updated to be a bit more const friendly. Also switched the linkage to be ↵Aaron Ballman2014-04-23
| | | | | | static since this function is file-local. No functional changes intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206982 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread safety analysis: add array operations to SExpr.DeLesley Hutchins2014-04-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206907 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread safety analysis: fix warning.DeLesley Hutchins2014-04-22
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206899 91177308-0d34-0410-b5e6-96231b3b80d8
* [Modules] Fix potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-22
| | | | | | | | | | definition below all of the header #include lines, clang edition. If you want more details about this, you can see some of the commits to Debug.h in LLVM recently. This is just the clang section of a cleanup I've done for all uses of DEBUG_TYPE in LLVM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206849 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread safety analysis: misc updates to SExpr handling. Fix to minimal SSA,DeLesley Hutchins2014-04-21
| | | | | | function parameters, and compound assignment. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206827 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread Safety Analysis: Convert to minimal SSA.DeLesley Hutchins2014-04-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206681 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread Safety Analysis: Update SSA pass to handle loops.DeLesley Hutchins2014-04-19
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206676 91177308-0d34-0410-b5e6-96231b3b80d8
* Updating to use more range-based for loops, nullptr and auto. No functional ↵Aaron Ballman2014-04-18
| | | | | | changes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206590 91177308-0d34-0410-b5e6-96231b3b80d8
* Making some public members into private members. This also introduces a bit ↵Aaron Ballman2014-04-17
| | | | | | 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
* Since the object is new'ed in the enterCFG function, now deleting in the ↵Aaron Ballman2014-04-17
| | | | | | exitCFG function instead of the destructor to ensure proper pairing. This allows reuse of the builder without creating a memory leak. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206471 91177308-0d34-0410-b5e6-96231b3b80d8
* -Wunreachable-code: refine recognition of unreachable "sigil" to cope with ↵Ted Kremenek2014-04-16
| | | | | | | | implicit casts in C++. Fixes <rdar://problem/16631033>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206360 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread Safety Analysis: rewrite SSA pass to use the new SExpr and CFGDeLesley Hutchins2014-04-15
| | | | | | | traversal system. The new pass is still undergoing testing; no change in functionality. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206338 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix typo from r206232Richard Trieu2014-04-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206234 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a bad interaction between -Wtautological-overlap-compare and delayedRichard Trieu2014-04-15
| | | | | | | diagnostics which caused delayed diagnostics on dead paths to be emitted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206232 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread Safety Analysis: reorganized SExpr header files. No change inDeLesley Hutchins2014-04-09
| | | | | | functionality. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205936 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread Safety Analysis: now with less includes. No functional changes.Aaron Ballman2014-04-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205929 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread Safety Analysis: some minor cleanups to the latest thread safety ↵Aaron Ballman2014-04-09
| | | | | | | | | | | | | changes. No functional changes intended. * Adds an iterator_range interface to CallExpr to get the arguments * Modifies SExpr such that it must be allocated in the Arena, and cannot be deleted * Minor const-correctness and nullptr updates * Adds some operator!= implementations to complement operator== * Removes unused functionality git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205915 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread Safety Analysis. Misc fixes to SExpr code, responding to code reviewDeLesley Hutchins2014-04-08
| | | | | | by Aaron Ballman. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205809 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread Safety Analysis: various fixes to new SExpr code.DeLesley Hutchins2014-04-07
| | | | | | Implemented ownership policy, updated to use nullptr, const-cleanup. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205745 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread Safety Analysis: update to internal SExpr handling.DeLesley Hutchins2014-04-07
| | | | | | | | | | 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
* Add a new subgroup to -Wtautological-compare, -Wtautological-overlap-compare,Richard Trieu2014-04-05
| | | | | | | | | | | | | | | which warns on compound conditionals that always evaluate to the same value. For instance, (x > 5 && x < 3) will always be false since no value for x can satisfy both conditions. This patch also changes the CFG to use these tautological values for better branch analysis. The test for -Wunreachable-code shows how this change catches additional dead code. Patch by Anders Rönnholm. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@205665 91177308-0d34-0410-b5e6-96231b3b80d8
* Updating the capability attribute diagnostics to be more capability-neutral. ↵Aaron Ballman2014-04-01
| | | | | | 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