Commit Graph

2757 Commits

Author SHA1 Message Date
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
Alexey Bataev 19acc3d351 Rename RefersToCapturedVariable to RefersToEnclosingVariableOrCapture, NFC
llvm-svn: 225624
2015-01-12 10:17:46 +00:00
Anna Zaks 87d404d458 [CallGraph] Make sure the edges are not missed due to re-declarations
A patch by Daniel DeFreez!

We were previously dropping edges on re-declarations. Store the
canonical declarations in the graph to ensure that different
references to the same function end up reflected with the same call graph
node.

(Note, this might lead to performance fluctuation because call graph
is used to determine the function analysis order.)

llvm-svn: 224398
2014-12-17 00:34:07 +00:00
Alexey Bataev 07649fb7c5 Renamed RefersToEnclosingLocal bitfield to RefersToCapturedVariable.
Bitfield RefersToEnclosingLocal of Stmt::DeclRefExprBitfields renamed to RefersToCapturedVariable to reflect latest changes introduced in commit 224323. Also renamed method Expr::refersToEnclosingLocal() to Expr::refersToCapturedVariable() and comments for constant arguments.
No functional changes.

llvm-svn: 224329
2014-12-16 08:01:48 +00:00
Richard Trieu c321b931c0 When checking for uninitialized values, do not confuse "std::move" with every
other function named "move".

llvm-svn: 222863
2014-11-27 01:29:32 +00:00
David Blaikie 82e95a3c79 Update for LLVM API change to make Small(Ptr)Set::insert return pair<iterator, bool> as per the C++ standard's associative container concept.
llvm-svn: 222335
2014-11-19 07:49:47 +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
Craig Topper 4501832555 Remove unused member variable.
llvm-svn: 220264
2014-10-21 04:19:18 +00:00
Daniel Dunbar 214671f98c [Analysis] Add missing newlines at end of file.
llvm-svn: 219439
2014-10-09 20:34:45 +00:00
Artyom Skrobov 27720765ed Reverting r214064 and r215650 while investigating a pesky performance regression
llvm-svn: 218296
2014-09-23 08:34:41 +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
Aaron Ballman 6afd1eb322 Fixing a -Woverflow warning from GCC by using a more natural datatype for this operation. NFC.
llvm-svn: 217670
2014-09-12 12:42:15 +00:00
Justin Bogner 560cbf506b Fix a couple of -Wsign-compare warnings introduced in r217556
llvm-svn: 217569
2014-09-11 03:37:42 +00:00
DeLesley Hutchins 4e38f100b5 Thread Safety Analysis: major update to thread safety TIL.
Numerous changes, including:
  * Changed the way variables and instructions are handled in basic blocks to
    be more efficient.
  * Eliminated SExprRef.
  * Simplified futures.
  * Fixed documentation.
  * Compute dominator and post dominator trees.

llvm-svn: 217556
2014-09-10 22:12:52 +00:00
Fariborz Jahanian 6485fe4b07 Objective-C. Under a special flag, -Wcstring-format-directive,
off by default, issue a warning if %s directive is used in
certain CF/NS formatting APIs, to assist user in deprecating
use of such %s in these APIs. rdar://18182443

llvm-svn: 217467
2014-09-09 23:10:54 +00:00
Hans Wennborg c597b4c529 MS format strings: parse the 'Z' printf conversion specifier (PR20808)
llvm-svn: 217326
2014-09-07 03:03:51 +00:00
Hans Wennborg 1b23158ce4 MS format strings: allow the 'h' length modifier with C, C, s and S (PR20808)
llvm-svn: 217196
2014-09-04 21:39:52 +00:00
Hans Wennborg 68f42b9515 MS format strings: support the 'w' length modifier (PR20808)
llvm-svn: 217195
2014-09-04 21:39:46 +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
Nico Weber ce069f11f9 Add a comment, no functional change.
llvm-svn: 216777
2014-08-29 21:05:44 +00:00
David Blaikie e90195c09b unique_ptrify the result of CFG::buildCFG/CFGBuilder::buildCFG
llvm-svn: 216755
2014-08-29 18:53:26 +00:00
Richard Trieu abf6ec45cd More -Wuninitialized updates
Fix r216438 to catch more complicated self-initialized in std::move.  For
instance, "Foo f = std::move(cond ? OtherFoo : (UNUSED_VALUE, f));"

Make sure that BinaryConditionalOperator, ConditionalOperator, BinaryOperator
with comma operator, and OpaqueValueExpr perform the correct usage forwarding
across the three uninitialized value checkers.

llvm-svn: 216627
2014-08-27 22:15:10 +00:00
Ted Kremenek eeccb30b94 Add support for the static analyzer to synthesize function implementations from external model files.
Currently the analyzer lazily models some functions using 'BodyFarm',
which constructs a fake function implementation that the analyzer
can simulate that approximates the semantics of the function when
it is called.  BodyFarm does this by constructing the AST for
such definitions on-the-fly.  One strength of BodyFarm
is that all symbols and types referenced by synthesized function
bodies are contextual adapted to the containing translation unit.
The downside is that these ASTs are hardcoded in Clang's own
source code.

A more scalable model is to allow these models to be defined as source
code in separate "model" files and have the analyzer use those
definitions lazily when a function body is needed.  Among other things,
it will allow more customization of the analyzer for specific APIs
and platforms.

This patch provides the initial infrastructure for this feature.
It extends BodyFarm to use an abstract API 'CodeInjector' that can be
used to synthesize function bodies.  That 'CodeInjector' is
implemented using a new 'ModelInjector' in libFrontend, which lazily
parses a model file and injects the ASTs into the current translation
unit.  

Models are currently found by specifying a 'model-path' as an
analyzer option; if no path is specified the CodeInjector is not
used, thus defaulting to the current behavior in the analyzer.

Models currently contain a single function definition, and can
be found by finding the file <function name>.model.  This is an
initial starting point for something more rich, but it bootstraps
this feature for future evolution.

This patch was contributed by Gábor Horváth as part of his
Google Summer of Code project.

Some notes:

- This introduces the notion of a "model file" into
  FrontendAction and the Preprocessor.  This nomenclature
  is specific to the static analyzer, but possibly could be
  generalized.  Essentially these are sources pulled in
  exogenously from the principal translation.

  Preprocessor gets a 'InitializeForModelFile' and
  'FinalizeForModelFile' which could possibly be hoisted out
  of Preprocessor if Preprocessor exposed a new API to
  change the PragmaHandlers and some other internal pieces.  This
  can be revisited.

  FrontendAction gets a 'isModelParsingAction()' predicate function
  used to allow a new FrontendAction to recycle the Preprocessor
  and ASTContext.  This name could probably be made something
  more general (i.e., not tied to 'model files') at the expense
  of losing the intent of why it exists.  This can be revisited.

- This is a moderate sized patch; it has gone through some amount of
  offline code review.  Most of the changes to the non-analyzer
  parts are fairly small, and would make little sense without
  the analyzer changes.

- Most of the analyzer changes are plumbing, with the interesting
  behavior being introduced by ModelInjector.cpp and
  ModelConsumer.cpp.

- The new functionality introduced by this change is off-by-default.
  It requires an analyzer config option to enable.

llvm-svn: 216550
2014-08-27 15:14:15 +00:00
Craig Topper 5fc8fc2d31 Simplify creation of a bunch of ArrayRefs by using None, makeArrayRef or just letting them be implicitly created.
llvm-svn: 216528
2014-08-27 06:28:36 +00:00
Richard Trieu 11fd079b6e Passing a variable to std::move now counts as a use for -Wuninitialized
llvm-svn: 216438
2014-08-26 04:30:55 +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
Artyom Skrobov a208a73390 Use the proper post-order traversal in LiveVariables analysis,
to recover the performance after r214064.

Also sorts out the naming for PostOrderCFGView, ReversePostOrderCFGView,
BackwardDataflowWorklist and ForwardDataflowWorklist, to match the accepted
terminology.

Also unifies BackwardDataflowWorklist and ForwardDataflowWorklist to share
the "worklist for prioritization, post-order traversal for fallback" logic,
and to avoid repetitive sorting.

Also cleans up comments in the affected area.

llvm-svn: 215650
2014-08-14 16:04:47 +00:00
Benjamin Kramer 2f5db8b3db Header guard canonicalization, clang part.
Modifications made by clang-tidy with minor tweaks.

llvm-svn: 215557
2014-08-13 16:25:19 +00:00
NAKAMURA Takumi 6b0fe34cc5 clangAnalysis: Avoid member initializers in TempDtorContext to appease msc17.
llvm-svn: 215193
2014-08-08 09:51:07 +00:00
Manuel Klimek deb0262a5e Fix branch reachabiliy annotation for temp dtor branches.
As we only create temp dtor decision branches when a temp dtor needs to
be run (as opposed to for each logical branch in the original
expression), we must include the information about all previous logical
branches when we annotate the temp dtor decision branch.

llvm-svn: 215188
2014-08-08 07:37:13 +00:00
Manuel Klimek edf925b935 Mark successors as reachable/unreachable instead of changing the CFG.
As suggested by Ted, this makes a few warnings less aggressive.

llvm-svn: 215128
2014-08-07 18:44:19 +00:00
Manuel Klimek cadc603e91 Fix CFG for temporary dtors when the branch taken is known.
Use the parent context when visiting temporaries when we do not insert a
temporary dtor decision branch.

llvm-svn: 215120
2014-08-07 17:02:21 +00:00
Manuel Klimek 7c03013c8b Model temporary destructors from logical operators with known values.
If the truth value of a LHS is known, we can build the knowledge whether
a temporary destructor is executed or not into the CFG. This is needed
by the return type analysis.

llvm-svn: 215118
2014-08-07 16:05:51 +00:00
Manuel Klimek 0ce9108104 Only have one path in the CFG for ternaries if the condition is known.
The return type analysis requires that the CFG is simplified when the
truth values of branches are statically known at analysis time.

llvm-svn: 215114
2014-08-07 14:25:43 +00:00
Manuel Klimek b5616c9f8d Re-applying r214962.
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
2014-08-07 10:42:17 +00:00
Rui Ueyama a89f9c8fdb Revert "Fix modelling of non-lifetime-extended temporary destructors in the 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
2014-08-06 22:01:54 +00:00
Manuel Klimek d9b4ad6e1f Fix modelling of non-lifetime-extended temporary destructors in the analyzer.
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
2014-08-06 12:45:51 +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
Manuel Klimek b0042c414e Fix some cases of incorrect handling of lifetime extended temporaries.
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
2014-07-30 08:34:42 +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
Artyom Skrobov 12ce6d91a1 Factoring DataflowWorklist out of LiveVariables and UninitializedValues analyses
llvm-svn: 214064
2014-07-28 08:47:38 +00:00
Richard Smith 4137af286f When looking for temporary dtors while building the CFG, do not walk into
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
2014-07-27 05:12:49 +00:00
NAKAMURA Takumi 04b8b37f56 Prune Redundant libdeps in CMake's target_link_libraries and LLVMBuild.txt.
I checked this with Release+Asserts on x86_64-mingw32. Please restore partially if this were overkill.

llvm-svn: 213064
2014-07-15 11:37:03 +00:00
NAKAMURA Takumi 23b702c8de [CMake] Update libdeps.
llvm-svn: 212920
2014-07-14 05:01:53 +00:00
NAKAMURA Takumi 4a070dc428 [CMake] Reorder libdeps by alphabetical order.
llvm-svn: 212919
2014-07-14 04:59:27 +00:00
Anna Zaks a6fea1386f Fix a crash in Retain Count checker error reporting
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
2014-06-13 23:47:38 +00:00
Richard Smith d88b44d444 PR19996: don't crash if -Wuninitialized sees a c++1y lambda init-capture.
llvm-svn: 210615
2014-06-11 00:31:00 +00:00
Richard Trieu ddd01cec0e Removing an "if (this == nullptr)" check from two print methods. The condition
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
2014-06-09 22:53:25 +00:00
DeLesley Hutchins b603192124 Thread Safety Analysis: implement review suggestions from Aaron Ballman.
llvm-svn: 209847
2014-05-29 21:24:16 +00:00
DeLesley Hutchins 44be81b5a9 Thread Safety Analysis: update TIL traversal mechanism to allow arbitrary
local contexts.  Also includes some minor refactoring.

llvm-svn: 209774
2014-05-28 21:28:13 +00:00
Nikola Smiljanic a9c452121a Fix line endings.
llvm-svn: 209727
2014-05-28 11:19:43 +00:00
Richard Trieu c771d5d79f Move the logic for testing for namespace std into one location. This check can
be performed by using Decl::isInStdNamespace or DeclContext::isStdNamespace

llvm-svn: 209708
2014-05-28 02:16:01 +00:00
Manuel Klimek 5fbdc93d97 Make dead return statement detection more robust against changes in the CFG.
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
2014-05-23 17:09:56 +00:00
Jordan Rose 7afd71e4ff Add a check for tautological bitwise comparisons to -Wtautological-compare.
This catches issues like:

if ((x & 8) == 4) { ... }
if ((x | 4) != 3) { ... }

Patch by Anders Rönnholm!

llvm-svn: 209221
2014-05-20 17:31:11 +00:00
Craig Topper 2554294321 [C++11] Use 'nullptr'. Analysis edition.
llvm-svn: 209191
2014-05-20 04:30:07 +00:00
DeLesley Hutchins f4b5e7c60f Thread Safety Analysis: add new node types to thread safety TIL.
This fills in a few missing gaps in functionality.

llvm-svn: 208830
2014-05-15 00:50:36 +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
Benjamin Kramer a7bcab75d2 ThreadSafetyAnalysis: Don't crash when trying to analyze objc methods.
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
2014-05-09 17:08:01 +00:00
Manuel Klimek b33bded176 Explicitly keep track of temporaries during the consumed analysis.
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
2014-05-08 11:50:00 +00:00
Manuel Klimek 75f34c1386 Fix handling of condition variables in the face of temp dtors.
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
2014-05-05 18:21:06 +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
Hans Wennborg 802df13e4d Fix bad comment from r207573.
llvm-svn: 207854
2014-05-02 18:12:30 +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 73b3651e9d Renaming the CallableState variadic attribute argument to be CallableStates. No functional changes intended.
llvm-svn: 207836
2014-05-02 13:17:57 +00:00
Hans Wennborg df51ee6c50 scanf analysis: handle scanlists that start with ^] (PR19559)
llvm-svn: 207573
2014-04-29 19:42:27 +00:00
Aaron Ballman 35897d97a3 Renaming range-based for loop variables so they don't appear iterator-like.
llvm-svn: 207422
2014-04-28 14:56:59 +00:00
Aaron Ballman fe46e62e99 [C++11] Converting to range-based for loops. No functional changes intended.
llvm-svn: 207416
2014-04-28 13:01:32 +00:00
Aaron Ballman 8e8026d5b3 Replacing a naked pointer with a unique_ptr. No functional changes intended.
llvm-svn: 206986
2014-04-23 14:26:59 +00:00
Aaron Ballman bf58a6a892 Updated to be a bit more const friendly. Also switched the linkage to be static since this function is file-local. No functional changes intended.
llvm-svn: 206982
2014-04-23 13:58:21 +00:00
DeLesley Hutchins f1a311653a Thread safety analysis: add array operations to SExpr.
llvm-svn: 206907
2014-04-22 17:31:23 +00:00
DeLesley Hutchins 7834001496 Thread safety analysis: fix warning.
llvm-svn: 206899
2014-04-22 14:51:04 +00:00
Chandler Carruth 1034666777 [Modules] Fix potential ODR violations by sinking the DEBUG_TYPE
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
2014-04-22 03:17:02 +00:00
DeLesley Hutchins f8b412adbb Thread safety analysis: misc updates to SExpr handling. Fix to minimal SSA,
function parameters, and compound assignment.

llvm-svn: 206827
2014-04-21 23:18:18 +00:00
DeLesley Hutchins a9db0019a2 Thread Safety Analysis: Convert to minimal SSA.
llvm-svn: 206681
2014-04-19 03:54:41 +00:00
DeLesley Hutchins ae497deddf Thread Safety Analysis: Update SSA pass to handle loops.
llvm-svn: 206676
2014-04-19 00:35:54 +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
Aaron Ballman ed5aced64e Since the object is new'ed in the enterCFG function, now deleting in the exitCFG function instead of the destructor to ensure proper pairing. This allows reuse of the builder without creating a memory leak.
llvm-svn: 206471
2014-04-17 15:23:50 +00:00
Ted Kremenek 6f375e5604 -Wunreachable-code: refine recognition of unreachable "sigil" to cope with implicit casts in C++.
Fixes <rdar://problem/16631033>.

llvm-svn: 206360
2014-04-16 07:26:09 +00:00
DeLesley Hutchins aab9aff058 Thread Safety Analysis: rewrite SSA pass to use the new SExpr and CFG
traversal system.  The new pass is still undergoing testing; no change in
functionality.

llvm-svn: 206338
2014-04-15 23:23:19 +00:00
Richard Trieu e729d9b598 Fix typo from r206232
llvm-svn: 206234
2014-04-15 01:06:38 +00:00
Richard Trieu e9fa266cba Fix a bad interaction between -Wtautological-overlap-compare and delayed
diagnostics which caused delayed diagnostics on dead paths to be emitted.

llvm-svn: 206232
2014-04-15 00:57:50 +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
Aaron Ballman 28347a72c9 Thread Safety Analysis: now with less includes. No functional changes.
llvm-svn: 205929
2014-04-09 21:12:04 +00:00
Aaron Ballman 3f993c1320 Thread Safety Analysis: some minor cleanups to the latest thread safety 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

llvm-svn: 205915
2014-04-09 17:45:44 +00:00
DeLesley Hutchins f7813c56b4 Thread Safety Analysis. Misc fixes to SExpr code, responding to code review
by Aaron Ballman.

llvm-svn: 205809
2014-04-08 22:21:22 +00:00
DeLesley Hutchins 11bb308739 Thread Safety Analysis: various fixes to new SExpr code.
Implemented ownership policy, updated to use nullptr, const-cleanup.

llvm-svn: 205745
2014-04-07 22:56:24 +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
Richard Trieu f935b562b9 Add a new subgroup to -Wtautological-compare, -Wtautological-overlap-compare,
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.

llvm-svn: 205665
2014-04-05 05:17:01 +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