summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
...
* Re-applying r214962.Manuel Klimek2014-08-071-137/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes to the original patch: - model the CFG for temporary destructors in conditional operators so that the destructors of the true and false branch are always exclusive. This is necessary because we must not have impossible paths for the path based analysis to work. - add multiple regression tests with ternary operators Original description: Fix modelling of non-lifetime-extended temporary destructors in the analyzer. Changes to the CFG: When creating the CFG for temporary destructors, we create a structure that mirrors the branch structure of the conditionally executed temporary constructors in a full expression. The branches we create use a CXXBindTemporaryExpr as terminator which corresponds to the temporary constructor which must have been executed to enter the destruction branch. 2. Changes to the Analyzer: When we visit a CXXBindTemporaryExpr we mark the CXXBindTemporaryExpr as executed in the state; when we reach a branch that contains the corresponding CXXBindTemporaryExpr as terminator, we branch out depending on whether the corresponding CXXBindTemporaryExpr was marked as executed. llvm-svn: 215096
* Revert "Fix modelling of non-lifetime-extended temporary destructors in the ↵Rui Ueyama2014-08-061-146/+139
| | | | | | | | | | | | | | | | | | | | analyzer." This reverts commit r214962 because after the change the following code doesn't compile with -Wreturn-type -Werror. #include <cstdlib> class NoReturn { public: ~NoReturn() __attribute__((noreturn)) { exit(1); } }; int check() { true ? NoReturn() : NoReturn(); } llvm-svn: 214998
* Fix modelling of non-lifetime-extended temporary destructors in the analyzer.Manuel Klimek2014-08-061-139/+146
| | | | | | | | | | | | | | | | | | | 1. Changes to the CFG: When creating the CFG for temporary destructors, we create a structure that mirrors the branch structure of the conditionally executed temporary constructors in a full expression. The branches we create use a CXXBindTemporaryExpr as terminator which corresponds to the temporary constructor which must have been executed to enter the destruction branch. 2. Changes to the Analyzer: When we visit a CXXBindTemporaryExpr we mark the CXXBindTemporaryExpr as executed in the state; when we reach a branch that contains the corresponding CXXBindTemporaryExpr as terminator, we branch out depending on whether the corresponding CXXBindTemporaryExpr was marked as executed. llvm-svn: 214962
* 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-042-280/+267
| | | | | | | capability expressions of the form !expr, and denote a capability that must not be held. llvm-svn: 214725
* Fix some cases of incorrect handling of lifetime extended temporaries.Manuel Klimek2014-07-301-11/+23
| | | | | | | | MaterializeTemporaryExpr already contains information about the lifetime of the temporary; if the lifetime is not the full statement, we do not want to emit a destructor at the end of the full statement for it. llvm-svn: 214292
* Thread Safety Analysis: Replace the old and broken SExpr with the newDeLesley Hutchins2014-07-283-759/+419
| | | | | | | | 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
* Factoring DataflowWorklist out of LiveVariables and UninitializedValues analysesArtyom Skrobov2014-07-284-117/+96
| | | | llvm-svn: 214064
* When looking for temporary dtors while building the CFG, do not walk intoRichard Smith2014-07-271-1/+26
| | | | | | | | | | lambda expressions (other than their capture initializers) nor blocks. Do walk into default argument expressions and default initializer expressions. These bugs were causing us to produce broken CFGs whenever a lambda expression was used to initialize a libstdc++ std::function object! llvm-svn: 214050
* Prune Redundant libdeps in CMake's target_link_libraries and LLVMBuild.txt.NAKAMURA Takumi2014-07-151-1/+0
| | | | | | I checked this with Release+Asserts on x86_64-mingw32. Please restore partially if this were overkill. llvm-svn: 213064
* [CMake] Update libdeps.NAKAMURA Takumi2014-07-141-0/+1
| | | | llvm-svn: 212920
* [CMake] Reorder libdeps by alphabetical order.NAKAMURA Takumi2014-07-141-1/+1
| | | | llvm-svn: 212919
* Fix a crash in Retain Count checker error reportingAnna Zaks2014-06-131-0/+4
| | | | | | | | | 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. llvm-svn: 210960
* PR19996: don't crash if -Wuninitialized sees a c++1y lambda init-capture.Richard Smith2014-06-111-1/+1
| | | | llvm-svn: 210615
* Removing an "if (this == nullptr)" check from two print methods. The conditionRichard Trieu2014-06-091-8/+15
| | | | | | | 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. llvm-svn: 210498
* Thread Safety Analysis: implement review suggestions from Aaron Ballman.DeLesley Hutchins2014-05-291-1/+1
| | | | llvm-svn: 209847
* Thread Safety Analysis: update TIL traversal mechanism to allow arbitraryDeLesley Hutchins2014-05-282-7/+50
| | | | | | local contexts. Also includes some minor refactoring. llvm-svn: 209774
* Fix line endings.Nikola Smiljanic2014-05-281-112/+112
| | | | llvm-svn: 209727
* Move the logic for testing for namespace std into one location. This check canRichard Trieu2014-05-281-13/+2
| | | | | | be performed by using Decl::isInStdNamespace or DeclContext::isStdNamespace llvm-svn: 209708
* Make dead return statement detection more robust against changes in the CFG.Manuel Klimek2014-05-231-21/+46
| | | | | | | | | | | | 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. llvm-svn: 209531
* Add a check for tautological bitwise comparisons to -Wtautological-compare.Jordan Rose2014-05-201-8/+35
| | | | | | | | | | | This catches issues like: if ((x & 8) == 4) { ... } if ((x | 4) != 3) { ... } Patch by Anders Rönnholm! llvm-svn: 209221
* [C++11] Use 'nullptr'. Analysis edition.Craig Topper2014-05-2016-305/+311
| | | | llvm-svn: 209191
* Thread Safety Analysis: add new node types to thread safety TIL.DeLesley Hutchins2014-05-153-97/+192
| | | | | | This fills in a few missing gaps in functionality. llvm-svn: 208830
* 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-093-1/+161
| | | | | | | | | | 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
* ThreadSafetyAnalysis: Don't crash when trying to analyze objc methods.Benjamin Kramer2014-05-091-4/+6
| | | | | | | | | | | 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. llvm-svn: 208436
* Explicitly keep track of temporaries during the consumed analysis.Manuel Klimek2014-05-081-4/+3
| | | | | | | This makes the consumed analysis less dependent on the CFG layout and fixes a bug where we wouldn't warn on an unconsumed value. llvm-svn: 208300
* Fix handling of condition variables in the face of temp dtors.Manuel Klimek2014-05-051-8/+5
| | | | | | | | 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. llvm-svn: 207985
* Remove unused typedef found by gcc's -Wunused-local-typedefs.Nico Weber2014-05-021-2/+0
| | | | llvm-svn: 207870
* Fix bad comment from r207573.Hans Wennborg2014-05-021-1/+1
| | | | llvm-svn: 207854
* Updated the attribute tablegen emitter for variadic arguments to emit a ↵Aaron Ballman2014-05-022-25/+16
| | | | | | range accessor in addition to the iterators. Updated code using iterators to use range-based for loops. llvm-svn: 207837
* Renaming the CallableState variadic attribute argument to be CallableStates. ↵Aaron Ballman2014-05-021-2/+2
| | | | | | No functional changes intended. llvm-svn: 207836
* scanf analysis: handle scanlists that start with ^] (PR19559)Hans Wennborg2014-04-291-0/+9
| | | | llvm-svn: 207573
* Renaming range-based for loop variables so they don't appear iterator-like.Aaron Ballman2014-04-281-23/+23
| | | | llvm-svn: 207422
* [C++11] Converting to range-based for loops. No functional changes intended.Aaron Ballman2014-04-281-46/+27
| | | | llvm-svn: 207416
* Replacing a naked pointer with a unique_ptr. No functional changes intended.Aaron Ballman2014-04-231-3/+3
| | | | llvm-svn: 206986
* Updated to be a bit more const friendly. Also switched the linkage to be ↵Aaron Ballman2014-04-231-3/+3
| | | | | | static since this function is file-local. No functional changes intended. llvm-svn: 206982
* Thread safety analysis: add array operations to SExpr.DeLesley Hutchins2014-04-221-1/+4
| | | | llvm-svn: 206907
* Thread safety analysis: fix warning.DeLesley Hutchins2014-04-221-2/+1
| | | | llvm-svn: 206899
* [Modules] Fix potential ODR violations by sinking the DEBUG_TYPEChandler Carruth2014-04-221-2/+2
| | | | | | | | | | 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. llvm-svn: 206849
* Thread safety analysis: misc updates to SExpr handling. Fix to minimal SSA,DeLesley Hutchins2014-04-211-39/+85
| | | | | | function parameters, and compound assignment. llvm-svn: 206827
* Thread Safety Analysis: Convert to minimal SSA.DeLesley Hutchins2014-04-191-17/+72
| | | | llvm-svn: 206681
* Thread Safety Analysis: Update SSA pass to handle loops.DeLesley Hutchins2014-04-191-85/+169
| | | | llvm-svn: 206676
* Updating to use more range-based for loops, nullptr and auto. No functional ↵Aaron Ballman2014-04-181-20/+14
| | | | | | changes. llvm-svn: 206590
OpenPOWER on IntegriCloud