History log of /external/clang/lib/Analysis/CFG.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
ef8225444452a1486bd721f3285301fe84643b00 21-Jul-2014 Stephen Hines <srhines@google.com> Update Clang for rebase to r212749.

This also fixes a small issue with arm_neon.h not being generated always.

Includes a cherry-pick of:
r213450 - fixes mac-specific header issue
r213126 - removes a default -Bsymbolic on Android

Change-Id: I2a790a0f5d3b2aab11de596fc3a74e7cbc99081d
6bcf27bb9a4b5c3f79cb44c0e4654a6d7619ad89 29-May-2014 Stephen Hines <srhines@google.com> Update Clang for 3.5 rebase (r209713).

Change-Id: I8c9133b0f8f776dc915f270b60f94962e771bc83
651f13cea278ec967336033dd032faef0e9fc2ec 24-Apr-2014 Stephen Hines <srhines@google.com> Updated to Clang 3.5a.

Change-Id: I8127eb568f674c2e72635b639a3295381fe8af82
29fc11a7abc06c30146a0ba3733da1c758586784 18-Nov-2013 Aaron Ballman <aaron@aaronballman.com> The code using the StmtPrinterHelper object failed to account for a null object in many cases, which could have led to crashes were it ever to be null. Now passing the object by reference instead of by pointer because it is never null in practice. No functional changes intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195043 91177308-0d34-0410-b5e6-96231b3b80d8
3f5b4de5a05c07a2af5b0e61e919ac0f803c78c9 23-Oct-2013 Jordan Rose <jordan_rose@apple.com> CFG: Properly print delegating initializer CFG elements.

...rather than segfaulting.

Patch by Enrico P!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193208 91177308-0d34-0410-b5e6-96231b3b80d8
a7be2f4c745120d6ee5adfd19ef259919bdc3f7f 09-Sep-2013 Matt Beaumont-Gay <matthewbg@google.com> Fix a crash introduced in r189828.

The predicates in CXXRecordDecl which test various properties of special
members can't be called on incomplete decls.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190353 91177308-0d34-0410-b5e6-96231b3b80d8
1ae74842cd1be37a8d99d0865623ef16432d3b67 06-Sep-2013 Pavel Labath <labath@google.com> Avoid double edges when constructing CFGs

If a noreturn destructor is executed while returning a value from a function,
the resulting CFG has had two edges to the exit block. This crashed the analyzer,
because it expects that blocks with no terminators have only one outgoing edge.
I added code to avoid creating the second edge in this case.

PS: The crashes did not manifest themselves always, as usually the
NoReturnFunctionChecker would stop program evaluation before the analyzer hit
the assertion, but in the case of lifetime extended temporaries, the checker
failed to do that (which is a separate bug in itself).

Reviewers: jordan_rose

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1513

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190125 91177308-0d34-0410-b5e6-96231b3b80d8
36d558d85653315edb389677e995ec9ccdbfbf3d 03-Sep-2013 Jordan Rose <jordan_rose@apple.com> Add an implicit dtor CFG node just before C++ 'delete' expressions.

This paves the way for adding support for modeling the destructor of a
region before it is deleted. The statement "delete <expr>" now generates
this series of CFG elements:

1. <expr>
2. [B1.1]->~Foo() (Implicit destructor)
3. delete [B1.1]

Patch by Karthik Bhat!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189828 91177308-0d34-0410-b5e6-96231b3b80d8
95ab9e306f4deefeabd89ea61987f4a8d67e0890 02-Sep-2013 Pavel Labath <labath@google.com> [analyzer] Add very limited support for temporary destructors

This is an improved version of r186498. It enables ExprEngine to reason about
temporary object destructors. However, these destructor calls are never
inlined, since this feature is still broken. Still, this is sufficient to
properly handle noreturn temporary destructors.

Now, the analyzer correctly handles expressions like "a || A()", and executes the
destructor of "A" only on the paths where "a" evaluted to false.

Temporary destructor processing is still off by default and one has to
explicitly request it by setting cfg-temporary-dtors=true.

Reviewers: jordan_rose

CC: cfe-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1259

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@189746 91177308-0d34-0410-b5e6-96231b3b80d8
7d0dcd2de023e2667a3f1f14daff9d087fab9bf7 19-Aug-2013 Jordan Rose <jordan_rose@apple.com> Omit arguments of __builtin_object_size from the CFG.

This builtin does not actually evaluate its arguments for side effects,
so we shouldn't include them in the CFG. In the analyzer, rely on the
constant expression evaluator to get the proper semantics, at least for
now. (In the future, we could get ambitious and try to provide path-
sensitive size values.)

In theory, this does pose a problem for liveness analysis: a variable can
be used within the __builtin_object_size argument expression but not show
up as live. However, it is very unlikely that such a value would be used
to compute the object size and not used to access the object in some way.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188679 91177308-0d34-0410-b5e6-96231b3b80d8
49bab4c0046e8300c79e79b7ca9a479696c7e87a 27-Jun-2013 Richard Smith <richard-llvm@metafoo.co.uk> Remove bogus VarDecl::extendsLifetimeOfTemporary function and inline it into
its only caller with a FIXME explaining why it's bogus.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185109 91177308-0d34-0410-b5e6-96231b3b80d8
4c98b1f67cdf385e05a86d54201b319cf1f1c042 22-Jun-2013 Anna Zaks <ganna@apple.com> [CFG] Set the “loop target” (back edge) for VisitObjCForCollectionStmt loops

Add the back edge info by creating a basic block, marked as loop target. This is
consistent with how other loops are processed, but was omitted from

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184617 91177308-0d34-0410-b5e6-96231b3b80d8
49a246f4fad959888bb0164c624c3c2b03078e91 06-Jun-2013 Jordan Rose <jordan_rose@apple.com> [analyzer; new edges] Simplify edges in a C++11 for-range loop.

Previously our edges were completely broken here; now, the final result
is a very simple set of edges in most cases: one up to the "for" keyword
for context, and one into the body of the loop. This matches the behavior
for ObjC for-in loops.

In the AST, however, CXXForRangeStmts are handled very differently from
ObjCForCollectionStmts. Since they are specified in terms of equivalent
statements in the C++ standard, we actually have implicit AST nodes for
all of the semantic statements. This makes evaluation very easy, but
diagnostic locations a bit trickier. Fortunately, the problem can be
generally defined away by marking all of the implicit statements as
part of the top-level for-range statement.

One of the implicit statements in a for-range statement is the declaration
of implicit iterators __begin and __end. The CFG synthesizes two
separate DeclStmts to match each of these decls, but until now these
synthetic DeclStmts weren't in the function's ParentMap. Now, the CFG
keeps track of its synthetic statements, and the AnalysisDeclContext will
make sure to add them to the ParentMap.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183449 91177308-0d34-0410-b5e6-96231b3b80d8
2a1551fa14728891bf8e325d3eb686ed404cd8b2 04-Jun-2013 David Majnemer <david.majnemer@gmail.com> Analysis: Add a CFG successor to a SwitchStmt if it is both empty and fully covered

Consider the case where a SwitchStmt satisfied isAllEnumCasesCovered()
as well as having no cases at all (i.e. the enum it covers has no

In this case, we should add a successor to repair the CFG.

This fixes PR16212.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183237 91177308-0d34-0410-b5e6-96231b3b80d8
2794bc0e3757992194dd587d0f6a253ec72afc9a 04-Jun-2013 Jordan Rose <jordan_rose@apple.com> CFG: In a DeclStmt, skip anything that's not a VarDecl.

Neither the compiler nor the analyzer are doing anything with non-VarDecl
decls in the CFG, and having them there creates extra nodes in the
analyzer's path diagnostics. Simplify the CFG (and the path edges) by
simply leaving them out. We can always add interesting decls back in when
they become relevant.

Note that this only affects decls declared in a DeclStmt, and then only
those that appear within a function body.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183157 91177308-0d34-0410-b5e6-96231b3b80d8
d049b40ef411eee12a735233dbe04fdc42c67e1a 16-May-2013 Jordan Rose <jordan_rose@apple.com> Remove unused, awkward CFGStmtVisitor and subclasses.

This class is a StmtVisitor that distinguishes between block-level and
non-block-level statements in a CFG. However, it does so using a hard-coded
idea of which statements might be block-level, which probably isn't accurate
anymore. The only implementer of the CFGStmtVisitor hierarchy was the
analyzer's DeadStoresChecker, and the analyzer creates a linearized CFG
anyway (every non-trivial statement is a block-level statement).

This also allows us to remove the block-expr map ("BlkExprMap"), which
mapped statements to positions in the CFG. Apart from having a helper type
that really should have just been Optional<unsigned>, it was only being
used to ask /if/ a particular expression was block-level, for traversal
purposes in CFGStmtVisitor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181945 91177308-0d34-0410-b5e6-96231b3b80d8
7247c88d1e41514a41085f83ebf03dd5220e054a 15-May-2013 David Blaikie <dblaikie@gmail.com> Use only explicit bool conversion operator

The most common (non-buggy) case are where such objects are used as
return expressions in bool-returning functions or as boolean function
arguments. In those cases I've used (& added if necessary) a named
function to provide the equivalent (or sometimes negative, depending on
convenient wording) test.

DiagnosticBuilder kept its implicit conversion operator owing to the
prevalent use of it in return statements.

One bug was found in ExprConstant.cpp involving a comparison of two
PointerUnions (PointerUnion did not previously have an operator==, so
instead both operands were converted to bool & then compared). A test
is included in test/SemaCXX/constant-expression-cxx1y.cpp for the fix
(adding operator== to PointerUnion in LLVM).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181869 91177308-0d34-0410-b5e6-96231b3b80d8
c3bf52ced9652f555aa0767bb822ec4c64546212 21-Apr-2013 Richard Smith <richard-llvm@metafoo.co.uk> C++1y: Allow aggregates to have default initializers.

Add a CXXDefaultInitExpr, analogous to CXXDefaultArgExpr, and use it both in
CXXCtorInitializers and in InitListExprs to represent a default initializer.

There's an additional complication here: because the default initializer can
refer to the initialized object via its 'this' pointer, we need to make sure
that 'this' points to the right thing within the evaluation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179958 91177308-0d34-0410-b5e6-96231b3b80d8
5062bb22706c8f2ceec5815533ff5a88d169d098 29-Mar-2013 Ted Kremenek <kremenek@apple.com> [cfg] Always guard (when AddStaticInitBranches == true) DeclStmts for static variables, not just ones with explicit initializers

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178322 91177308-0d34-0410-b5e6-96231b3b80d8
0f5c5c60e9806d13f0907cd99d7204ffab0e08f7 29-Mar-2013 Ted Kremenek <kremenek@apple.com> Add static analyzer support for conditionally executing static initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178318 91177308-0d34-0410-b5e6-96231b3b80d8
fbd4b5dc7febd1d8b4fa64ab00a29d72b44bec7b 28-Mar-2013 Ted Kremenek <kremenek@apple.com> Add CFG logic to create a conditional branch for modeling static initializers.

This is an optional variant of the CFG. This allows analyses to model whether
or not a static initializer has run, e.g.:

static Foo x = bar();

For basic dataflow analysis in Sema we will just assume that the initializer
always runs. For the static analyzer we can use this branch to accurately
track whether or not initializers are on.

This patch just adds the (opt-in) functionality to the CFG. The
static analyzer still needs to be modified to adopt this feature.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178263 91177308-0d34-0410-b5e6-96231b3b80d8
8343f8e00a222ca09dde536c77313e3e6e03ad59 27-Mar-2013 Rafael Espindola <rafael.espindola@gmail.com> Add const in preparation for a simplify_type change in llvm.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178146 91177308-0d34-0410-b5e6-96231b3b80d8
b07805485c603be3d8011f72611465324c9e664b 23-Feb-2013 David Blaikie <dblaikie@gmail.com> Remove the CFGElement "Invalid" state.

Use Optional<CFG*> where invalid states were needed previously. In the one case
where that's not possible (beginAutomaticObjDtorsInsert) just use a dummy

Thanks for the help from Jordan Rose & discussion/feedback from Ted Kremenek
and Doug Gregor.

Post commit code review feedback on r175796 by Ted Kremenek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175938 91177308-0d34-0410-b5e6-96231b3b80d8
fdf6a279c9a75c778eba382d9a156697092982a1 21-Feb-2013 David Blaikie <dblaikie@gmail.com> Replace CFGElement llvm::cast support to be well-defined.

See r175462 for another example/more details.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175796 91177308-0d34-0410-b5e6-96231b3b80d8
b1855de3d61eab7d2f2e616ed59195f83e2a6dc0 05-Feb-2013 Ted Kremenek <kremenek@apple.com> Add note why we used a switch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174449 91177308-0d34-0410-b5e6-96231b3b80d8
5846720f08a6b225484bfe663599c2b057a99bc8 05-Feb-2013 Ted Kremenek <kremenek@apple.com> Change subexpressions to be visited in the CFG from left-to-right.

This is a more natural order of evaluation, and it is very important
for visualization in the static analyzer. Within Xcode, the arrows
will not jump from right to left, which looks very visually jarring.
It also provides a more natural location for dataflow-based diagnostics.

Along the way, we found a case in the analyzer diagnostics where we
needed to indicate that a variable was "captured" by a block.

-fsyntax-only timings on sqlite3.c show no visible performance change,
although this is just one test case.

Fixes <rdar://problem/13016513>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174447 91177308-0d34-0410-b5e6-96231b3b80d8
cd8ab51a44e80625d84126780b0d85a7732e25af 17-Jan-2013 Richard Smith <richard-llvm@metafoo.co.uk> Implement C++11 semantics for [[noreturn]] attribute. This required splitting
it apart from [[gnu::noreturn]] / __attribute__((noreturn)), since their
semantics are not equivalent (for instance, we treat [[gnu::noreturn]] as
affecting the function type, whereas [[noreturn]] does not).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172691 91177308-0d34-0410-b5e6-96231b3b80d8
dac62528c1a66db867e21cfa7cfc439d557d6f0c 07-Jan-2013 Will Dietz <wdietz2@illinois.edu> CFG.cpp: Fix wrapping logic when printing block preds/succs.

First check only wrapped with i==8, second wrapped at i==2,8,18,28,...
This fix restores the intended behavior: i==8,18,28,...

Found with -fsanitize=integer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@171718 91177308-0d34-0410-b5e6-96231b3b80d8
2fa67efeaf66a9332c30a026dc1c21bef6c33a6c 01-Dec-2012 Benjamin Kramer <benny.kra@googlemail.com> Pull the Attr iteration parts out of Attr.h, so including DeclBase.h doesn't pull in all the generated Attr code.

Required to pull some functions out of line, but this shouldn't have a perf impact.
No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169092 91177308-0d34-0410-b5e6-96231b3b80d8
8f81acfa95a5d2a22fc875c1a10901eaa30b8405 13-Nov-2012 Ted Kremenek <kremenek@apple.com> Fix bad CFG construction bug when handling C++ 'try' statements.

This code assigned the last created CFGBlock* to the variable 'Block',
which is a scratch variable which is null'ed out after a block is
completed. By assigning the last created block to 'Block', we start
editing a completed block, inserting CFGStmts that should be in
another block. This was the case with 'try'. The test case that
showed this had a while loop inside a 'try', and the logic before
the while loop was being included as part of the "condition block"
for the loop. This showed up as a bogus dead store, but could
have lots of implications.

Turns out this bug was replicated a few times within CFG.cpp, so
I went and fixed up those as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167788 91177308-0d34-0410-b5e6-96231b3b80d8
507d106c758e745d3f71f44639092eb97d356525 13-Oct-2012 Ted Kremenek <kremenek@apple.com> Fix potential null deference in CFG printer.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165836 91177308-0d34-0410-b5e6-96231b3b80d8
857f5681f5e2bbb482f41f461add502b556c712a 13-Oct-2012 Ted Kremenek <kremenek@apple.com> Remove dead store.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165835 91177308-0d34-0410-b5e6-96231b3b80d8
5a1ffe98b04120846a15f7105905b5f363b08635 06-Sep-2012 Jordan Rose <jordan_rose@apple.com> [analyzer] Always include destructors in the analysis CFG.

While destructors will continue to not be inlined (unless the analyzer
config option 'c++-inlining' is set to 'destructors'), leaving them out
of the CFG is an incomplete model of the behavior of an object, and
can cause false positive warnings (like PR13751, now working).

Destructors for temporaries are still not on by default, since
(a) we haven't actually checked this code to be sure it's fully correct
(in particular, we probably need to be very careful with regard to
lifetime-extension when a temporary is bound to a reference,
C++11 [class.temporary]p5), and
(b) ExprEngine doesn't actually do anything when it sees a temporary
destructor in the CFG -- not even invalidate the object region.

To enable temporary destructors, set the 'cfg-temporary-dtors' analyzer
config option to '1'. The old -cfg-add-implicit-dtors cc1 option, which
controlled all implicit destructors, has been removed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163264 91177308-0d34-0410-b5e6-96231b3b80d8
3d1125b27e8006385a830f5b3748b7b44d227b4c 24-Aug-2012 Ted Kremenek <kremenek@apple.com> Teach CFG that 'if (x & 0)' and 'if (x * 0)' is an unfeasible branch.

Fixes <rdar://problem/11005770>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162545 91177308-0d34-0410-b5e6-96231b3b80d8
b66529d04727dc686b97ea3d937fc9785792f505 23-Aug-2012 Jordan Rose <jordan_rose@apple.com> [analyzer] Support C++ default arguments if they are literal values.

A CXXDefaultArgExpr wraps an Expr owned by a ParmVarDecl belonging to the
called function. In general, ExprEngine and Environment ought to treat this
like a ParenExpr or other transparent wrapper expression, with the inside
expression evaluated first.

However, if we call the same function twice, we'd produce a CFG that contains
the same wrapped expression twice, and we're not set up to handle that. I've
added a FIXME to the CFG builder to come back to that, but meanwhile we can
at least handle expressions that don't need to be explicitly evaluated:
literals. This probably handles many common uses of default parameters:
true/false, null, etc.

Part of PR13385 / <rdar://problem/12156507>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162453 91177308-0d34-0410-b5e6-96231b3b80d8
66c486f275531df6362b3511fc3af6563561801b 22-Aug-2012 Ted Kremenek <kremenek@apple.com> Rename 'currentX' to 'currX' throughout analyzer and libAnalysis.
Also rename 'getCurrentBlockCounter()' to 'blockCount()'.

This ripples a bunch of code simplifications; mostly aesthetic,
but makes the code a bit tighter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162349 91177308-0d34-0410-b5e6-96231b3b80d8
b9d0b76e42fd2d4cdfd135220302458d03ad09fe 27-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> Final piece of core issue 1330: delay computing the exception specification of
a defaulted special member function until the exception specification is needed
(using the same criteria used for the delayed instantiation of exception
specifications for function temploids).

EST_Delayed is now EST_Unevaluated (using 1330's terminology), and, like
EST_Uninstantiated, carries a pointer to the FunctionDecl which will be used to
resolve the exception specification.

This is enabled for all C++ modes: it's a little faster in the case where the
exception specification isn't used, allows our C++11-in-C++98 extensions to
work, and is still correct for C++98, since in that mode the computation of the
exception specification can't fail.

The diagnostics here aren't great (in particular, we should include implicit
evaluation of exception specifications for defaulted special members in the
template instantiation backtraces), but they're not much worse than before.

Our approach to the problem of cycles between in-class initializers and the
exception specification for a defaulted default constructor is modified a
little by this change -- we now reject any odr-use of a defaulted default
constructor if that constructor uses an in-class initializer and the use is in
an in-class initialzer which is declared lexically earlier. This is a closer
approximation to the current draft solution in core issue 1351, but isn't an
exact match (but the current draft wording isn't reasonable, so that's to be

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160847 91177308-0d34-0410-b5e6-96231b3b80d8
56df4a9e0461d4dfb2a740cb6b0ce531d6c82538 24-Jul-2012 Richard Smith <richard-llvm@metafoo.co.uk> When a && or || appears as the condition of a ?:, perform appropriate
short-circuiting when building the CFG. Also be sure to skip parens before
checking for the && / || special cases. Finally, fix some crashes in CFG
printing in the presence of calls to destructors for array of array of class

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160691 91177308-0d34-0410-b5e6-96231b3b80d8
fd8b43596478b779b6777cb3a595e69d7856c378 20-Jul-2012 Jordan Rose <jordan_rose@apple.com> Add a reverse iterator to DeclStmt, and use it when building a CFG.

The CFG creates dummy DeclStmts with one Decl per statement, and it has
to do so from last to first in order to build the graph correctly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160560 91177308-0d34-0410-b5e6-96231b3b80d8
88237bf587581026dcfc8386abf055cb201aa487 18-Jul-2012 Ted Kremenek <kremenek@apple.com> Teach CFG construction about destructors resulting from references to array types. Fixes crash in <rdar://problem/11671507>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160424 91177308-0d34-0410-b5e6-96231b3b80d8
3f635c08b2d0b2d5bafb38da09589cb238407faa 14-Jul-2012 Ted Kremenek <kremenek@apple.com> Refine CFG so that '&&' and '||' don't lead to extra confluence points when used in a branch, but
instead push the terminator for the branch down into the basic blocks of the subexpressions of '&&' and '||'
respectively. This eliminates some artifical control-flow from the CFG and results in a more
compact CFG.

Note that this patch only alters the branches 'while', 'if' and 'for'. This was complex enough for
one patch. The remaining branches (e.g., do...while) can be handled in a separate patch, but they
weren't immediately tackled because they were less important.

It is possible that this patch introduces some subtle bugs, particularly w.r.t. to destructor placement.
I've tried to audit these changes, but it is also known that the destructor logic needs some refinement
in the area of '||' and '&&' regardless (i.e., their are known bugs).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160218 91177308-0d34-0410-b5e6-96231b3b80d8
5c3ea5c57971317c35b120ef0a2a2c79bd171008 14-Jul-2012 Ted Kremenek <kremenek@apple.com> Hoist CFG builder logic for '&&' and '||' into helper method. No funcationlity change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160217 91177308-0d34-0410-b5e6-96231b3b80d8
449d4d5a338690d35deb6cf57ccd4e02edd5ceca 14-Jul-2012 Ted Kremenek <kremenek@apple.com> Remove unused method declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160216 91177308-0d34-0410-b5e6-96231b3b80d8
6960ee6c7cc8a8883126d9861beecb51a4e4a475 14-Jul-2012 Ted Kremenek <kremenek@apple.com> Sort prototypes. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160215 91177308-0d34-0410-b5e6-96231b3b80d8
478851c3ed6bd784e7377dffd8e57b200c1b9ba9 04-Jul-2012 Benjamin Kramer <benny.kra@googlemail.com> Drop the ASTContext.h include from Stmt.h and fix up transitive users.

This required moving the ctors for IntegerLiteral and FloatingLiteral out of
line which shouldn't change anything as they are usually called through Create
methods that are already out of line.

ASTContext::Deallocate has been a nop for a long time, drop it from ASTVector
and make it independent from ASTContext.h

Pass the StorageAllocator directly to AccessedEntity so it doesn't need to
have a definition of ASTContext around.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@159718 91177308-0d34-0410-b5e6-96231b3b80d8
581deb3da481053c4993c7600f97acf7768caac5 06-Jun-2012 David Blaikie <dblaikie@gmail.com> Revert Decl's iterators back to pointer value_type rather than reference value_type

In addition, I've made the pointer and reference typedef 'void' rather than T*
just so they can't get misused. I would've omitted them entirely but
std::distance likes them to be there even if it doesn't use them.

This rolls back r155808 and r155869.

Review by Doug Gregor incorporating feedback from Chandler Carruth.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158104 91177308-0d34-0410-b5e6-96231b3b80d8
a08e7bc74b5635995fc50009f240dd3feb1999e2 06-Jun-2012 Francois Pichet <pichet2000@gmail.com> Zap the /Za compiler switch from MSVC projects, the option is considered harmful even by Microsoft people and clang won't build using the MSVC 2012 RC if not removed.

Only 1 minor code change was necessary: can't use cdecl as variable name anymore.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158063 91177308-0d34-0410-b5e6-96231b3b80d8
e0d3b4cd2b66f1cef26cacbed5820ab7c22ad5b3 03-May-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add -Wimplicit-fallthrough warning flag, which warns on fallthrough between
cases in switch statements. Also add a [[clang::fallthrough]] attribute, which
can be used to suppress the warning in the case of intentional fallthrough.

Patch by Alexander Kornienko!

The handling of C++11 attribute namespaces in this patch is temporary, and will
be replaced with a cleaner mechanism in a subsequent patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156086 91177308-0d34-0410-b5e6-96231b3b80d8
262bc18e32500558af7cb0afa205b34bd37bafed 30-Apr-2012 David Blaikie <dblaikie@gmail.com> Remove the ref/value inconsistency in filter_decl_iterator.

filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.

This change errs on the side of value, making op-> return T* and op* return

(reviewed by Richard Smith)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@155808 91177308-0d34-0410-b5e6-96231b3b80d8
e6975e9b0985ad7f7ff9187e38d95bfe9ac4181b 17-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.

We have a new flavor of exception specification, EST_Uninstantiated. A function
type with this exception specification carries a pointer to a FunctionDecl, and
the exception specification for that FunctionDecl is instantiated (if needed)
and used in the place of the function type's exception specification.

When a function template declaration with a non-trivial exception specification
is instantiated, the specialization's exception specification is set to this
new 'uninstantiated' kind rather than being instantiated immediately.

Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs
on-demand. Also, any odr-use of a function triggers the instantiation of its
exception specification (the exception specification could be needed by IRGen).
In passing, fix two places where a DeclRefExpr was created but the corresponding
function was not actually marked odr-used. We used to get away with this, but
don't any more.

Also fix a bug where instantiating an exception specification which refers to
function parameters resulted in a crash. We still have the same bug in default
arguments, which I'll be looking into next.

This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to
parse (and, in very limited testing, support) all of libstdc++4.7's standard

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154886 91177308-0d34-0410-b5e6-96231b3b80d8
534986f2b21e6050bf00163cd6423fd92155a6ed 14-Apr-2012 Richard Smith <richard-llvm@metafoo.co.uk> Add an AttributedStmt type to represent a statement with C++11 attributes
attached. Since we do not support any attributes which appertain to a statement
(yet), testing of this is necessarily quite minimal.

Patch by Alexander Kornienko!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154723 91177308-0d34-0410-b5e6-96231b3b80d8
83748e2f41ea0ac7c954946feb5da9ccc6ab8bec 12-Apr-2012 Ted Kremenek <kremenek@apple.com> Include lambda capture init expressions in CFG.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154611 91177308-0d34-0410-b5e6-96231b3b80d8
55331da3211151aa67277aa095b7d301342200d4 12-Apr-2012 Ted Kremenek <kremenek@apple.com> Fix CFGBuilder to not include the body of a LambdaExpr in the CFG of the enclosing function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154607 91177308-0d34-0410-b5e6-96231b3b80d8
6955da2cad4bce19c541ddb85a6d965d77a1a4ab 25-Mar-2012 NAKAMURA Takumi <geek4civic@gmail.com> clang/lib/Analysis/CFG.cpp: Get rid of early insertion of placeholder to the map.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153407 91177308-0d34-0410-b5e6-96231b3b80d8
9260f618e72f7c70dc76312f95d679f0ed03858c 25-Mar-2012 NAKAMURA Takumi <geek4civic@gmail.com> clang/lib/Analysis/CFG.cpp: Fix memory leak since r153297.

evaluateAsBooleanConditionNoCache(S) might update the map and invalidate the iterator.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153406 91177308-0d34-0410-b5e6-96231b3b80d8
8c6d360636dee25f1ce071c3656810c6632cb89d 23-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> [CFG] Cache boolean evaluations of expressions to avoid multiple re-evaluations
during construction of branches for chained logical operators.

This makes -fsyntax-only for test/Sema/many-logical-ops.c about 32x times faster.

With measuring SemaExpr.cpp I see differences below the noise level.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153297 91177308-0d34-0410-b5e6-96231b3b80d8
550f2234fc9218914c325041067052342dfce553 22-Mar-2012 Ted Kremenek <kremenek@apple.com> Fix broken CFG when an initializer is a statement expression that starts with a while loop (PR 12325).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153242 91177308-0d34-0410-b5e6-96231b3b80d8
4cf225382a8b061dce41733c962d62b6db9721f8 20-Mar-2012 Ted Kremenek <kremenek@apple.com> Fix crash when querying the CFG reported when using the thread safety analysis
on code using multi-dimensional arrays. Fix by DeLesley Hutchins, and reported in
PR 12271.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153067 91177308-0d34-0410-b5e6-96231b3b80d8
4e4d08403ca5cfd4d558fa2936215d3a4e5a528d 11-Mar-2012 David Blaikie <dblaikie@gmail.com> Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).

The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152536 91177308-0d34-0410-b5e6-96231b3b80d8
337e4dbc6859589b8878146a88bebf754e916702 10-Mar-2012 Ted Kremenek <kremenek@apple.com> [analyzer] fix regression in analyzer of NOT actually aborting on Stmts it doesn't understand. We registered
as aborted, but didn't treat such cases as sinks in the ExplodedGraph.

Along the way, add basic support for CXXCatchStmt, expanding the set of code we actually analyze (hopefully correctly).

Fixes: <rdar://problem/10892489>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152468 91177308-0d34-0410-b5e6-96231b3b80d8
9fcce65e7e1307b5b8da9be13e4092d6bb94dc1d 07-Mar-2012 Richard Smith <richard-llvm@metafoo.co.uk> AST representation for user-defined literals, plus just enough of semantic
analysis to make the AST representation testable. They are represented by a
new UserDefinedLiteral AST node, which is a sugared CallExpr. All semantic
properties, including full CodeGen support, are achieved for free by this

UserDefinedLiterals can never be dependent, so no custom instantiation
behavior is required. They are mangled as if they were direct calls to the
underlying literal operator. This matches g++'s apparent behavior (but not its
actual mangling, which is broken for literal-operator-ids).

User-defined *string* literals are now fully-operational, but the semantic
analysis is quite hacky and needs more work. No other forms of user-defined
literal are created yet, but the AST support for them is present.

This patch committed after midnight because we had already hit the quota for
new kinds of literal yesterday.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152211 91177308-0d34-0410-b5e6-96231b3b80d8
8e282c332f8ad51dedf86a185a4dcb78ef93fb51 07-Mar-2012 Ted Kremenek <kremenek@apple.com> Fix horrific CFG bug where '@autoreleasepool' would be put in a dangling block in the CFG.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152163 91177308-0d34-0410-b5e6-96231b3b80d8
b2c60b04a597cc5ba4154837cf8e0a155a376fd7 01-Mar-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move llvm/ADT/SaveAndRestore.h -> llvm/Support/SaveAndRestore.h.

Needs llvm update.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151829 91177308-0d34-0410-b5e6-96231b3b80d8
d45d361f2ce5c37824052357e2218e8a5509eba5 27-Feb-2012 Argyrios Kyrtzidis <akyrtzi@gmail.com> Move "clang/Analysis/Support/SaveAndRestore.h" to "llvm/ADT/SaveAndRestore.h"
to make it more widely available.

Depends on llvm commit r151564

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151566 91177308-0d34-0410-b5e6-96231b3b80d8
6f42b62b6194f53bcbc349f5d17388e1936535d7 05-Feb-2012 Dylan Noblesmith <nobled@dreamwidth.org> Basic: import OwningPtr<> into clang namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149798 91177308-0d34-0410-b5e6-96231b3b80d8
54a7e3f6778c804d0fe983efb9f62d6d27d86eb4 31-Jan-2012 Erik Verbruggen <erikjv@me.com> [CFG] Removed unused local variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149385 91177308-0d34-0410-b5e6-96231b3b80d8
23661d3e348c5f44ae89b6848bbc331829bb46f2 24-Jan-2012 David Blaikie <dblaikie@gmail.com> Revert various template unreachability code I committed accidentally.

r148774, r148775, r148776, r148777

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148780 91177308-0d34-0410-b5e6-96231b3b80d8
a9bb955b499c244d24d02311f0f9100ade506794 24-Jan-2012 David Blaikie <dblaikie@gmail.com> More fixes/tests.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148777 91177308-0d34-0410-b5e6-96231b3b80d8
7154c03b366c4a6d83c086b624af269f779eb7b0 24-Jan-2012 David Blaikie <dblaikie@gmail.com> Support undefined dependent bases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148775 91177308-0d34-0410-b5e6-96231b3b80d8
3026348bd4c13a0f83b59839f64065e0fcbea253 20-Jan-2012 David Blaikie <dblaikie@gmail.com> More dead code removal (using -Wunreachable-code)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@148577 91177308-0d34-0410-b5e6-96231b3b80d8
97a72c35a62304c3781aa280e28cb97a59afd585 11-Jan-2012 Zhongxing Xu <xuzhongxing@foxmail.com> Add elidable CXXConstructExpr as block-level expr. It converts an lvalue to a rvalue, which is a useful step during AST evaluation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147918 91177308-0d34-0410-b5e6-96231b3b80d8
72b20ff76a9070c1a481331e857aa825ae37c97f 28-Dec-2011 Zhongxing Xu <xuzhongxing@foxmail.com> Enable the user to control whether CXXConstructExpr will be added as a
block-level expr. Currently CXXConstructExpr is always added as a block-level
expr. This caused two problems for the analyzer (and potentially for the
CFG-based codegen).
1. We have no way to know whether a ctor call is base or complete.
2. We have no way to know the destination object being contructed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147306 91177308-0d34-0410-b5e6-96231b3b80d8
682060c5d95f6e4f79536013781ab0870cdd3850 23-Dec-2011 Ted Kremenek <kremenek@apple.com> Colorize and condense CFG pretty-printing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147203 91177308-0d34-0410-b5e6-96231b3b80d8
3b7a48fbc681c6fb59e5304a210c30dbb49dabea 21-Dec-2011 Ted Kremenek <kremenek@apple.com> Improve CFG pretty-printing for CXXConstructExprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147068 91177308-0d34-0410-b5e6-96231b3b80d8
893d414534273e153e12aef39a1ad991c6fa94c0 21-Dec-2011 Ted Kremenek <kremenek@apple.com> Improve CFG pretty-printing of CastExprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@147066 91177308-0d34-0410-b5e6-96231b3b80d8
02f34c5003b2c5067675f89ffce0a84c28faf722 05-Dec-2011 Anna Zaks <ganna@apple.com> [analyzer] Rely on LLVM Dominators in Clang dominator computation.

(Previously, Clang used it's implementation of dominators.)

The patch is contributed by Guoping Long!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145858 91177308-0d34-0410-b5e6-96231b3b80d8
2d9eb21325a0854e86de7344f54a8e6cef2a97ad 15-Nov-2011 Douglas Gregor <dgregor@apple.com> Teach the CFG builder how to properly destroy temporaries who
lifetimes have been extended via reference binding. The type of the
reference and the type of the temporary are not necessarily the same,
which could cause a crash. Fixes <rdar://problem/10398199>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144646 91177308-0d34-0410-b5e6-96231b3b80d8
4b9c2d235fb9449e249d74f48ecfec601650de93 06-Nov-2011 John McCall <rjmccall@apple.com> Change the AST representation of operations on Objective-C
property references to use a new PseudoObjectExpr
expression which pairs a syntactic form of the expression
with a set of semantic expressions implementing it.
This should significantly reduce the complexity required
elsewhere in the compiler to deal with these kinds of
expressions (e.g. IR generation's special l-value kind,
the static analyzer's Message abstraction), at the lower
cost of specifically dealing with the odd AST structure
of these expressions. It should also greatly simplify
efforts to implement similar language features in the
future, most notably Managed C++'s properties and indexed

Most of the effort here is in dealing with the various
clients of the AST. I've gone ahead and simplified the
ObjC rewriter's use of properties; other clients, like
IR-gen and the static analyzer, have all the old
complexity *and* all the new complexity, at least
temporarily. Many thanks to Ted for writing and advising
on the necessary changes to the static analyzer.

I've xfailed a small diagnostics regression in the static
analyzer at Ted's request.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143867 91177308-0d34-0410-b5e6-96231b3b80d8
6a9065a39ab15383082b914af28759da1652db18 05-Nov-2011 Ted Kremenek <kremenek@apple.com> Per discussion with John McCall, don't add OpaqueValueExprs to the CFG.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143766 91177308-0d34-0410-b5e6-96231b3b80d8
51f4708c00110940ca3f337961915f2ca1668375 29-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Rename Expr::Evaluate to Expr::EvaluateAsRValue to make it clear that it will
implicitly perform an lvalue-to-rvalue conversion if used on an lvalue
expression. Also improve the documentation of Expr::Evaluate* to indicate which
of them will accept expressions with side-effects.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@143263 91177308-0d34-0410-b5e6-96231b3b80d8
85df96c1f04867e26ba069aa0cc6a4cd6a01292e 14-Oct-2011 Richard Smith <richard-llvm@metafoo.co.uk> Refactor static analyzer to use simpler interface to constant expression evaluation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141983 91177308-0d34-0410-b5e6-96231b3b80d8
b219cfc4d75f0a03630b7c4509ef791b7e97b2c8 23-Sep-2011 David Blaikie <dblaikie@gmail.com> Switch assert(0/false) llvm_unreachable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140367 91177308-0d34-0410-b5e6-96231b3b80d8
83754162f698a5dafad93fb89be0953651a604d0 13-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Add a bit to the CFGBlock to track when it contains a no-return
CFGElement. This will allow greatly simplifying the logic in

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139593 91177308-0d34-0410-b5e6-96231b3b80d8
dba3fb5413437dc613734fa4ffac892b11a37d25 13-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Consolidate the logic for building a no-return CFG block into a single
location with a single comment rather than scattering it in three

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139592 91177308-0d34-0410-b5e6-96231b3b80d8
c8cfc74bdcc999828bc232294d937fb191940d5b 13-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Enhance the CFG construction to detect no-return destructors for
temporary objects and local variables. When detected, these split the
block, marking the new one as having only the exit block as a successor.
This prevents a large number of false positives in warnings sensitive to
no-return constructs such as -Wreturn-type, and fixes the remainder of
PR10063 along with several variations of this bug that had not been
reported. The test cases are extended across the board to cover these

This also checks in a stress test for these types of CFGs. The stress
test declares some 32k variables, a mixture of no-return and normal
destructors. Previously, this resulted in roughly 2500 CFG blocks, but
didn't model any of the no-return destructors. With this patch, it
results in over 33k blocks, many of them now unreachable.

The nice thing about how the analyzer is set up? This causes *no*
regression in performance of building the CFG. It actually in some cases
makes it faster, as best I can benchmark. The analysis for -Wreturn-type
(and any other that cares about no-return code paths) is technically
slower now as it has to look at many more candidate blocks, but it
computes the correct answer. I have more test cases to follow, I think
they all work now. Also I have further work that should dramatically
simplify analyses in the presence of no-return.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139586 91177308-0d34-0410-b5e6-96231b3b80d8
a1364be341550d71dff27dd8de0c6872ba6c707e 10-Sep-2011 Chandler Carruth <chandlerc@gmail.com> Extend the Stmt AST to make it easier to look through label, default,
and case statements. Use this to make the logic in the CFG builder more
robust at finding the actual statements within a compound statement,
even when there are many layers of labels obscuring it.

Also extend the test cases for a large chunk of PR10063. Still more work
to do here though.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139437 91177308-0d34-0410-b5e6-96231b3b80d8
f0e71aede7ccf3e311feac6a414c431f7a0fc3c8 24-Aug-2011 Ted Kremenek <kremenek@apple.com> CFG: record set of C++ 'try' dispatch blocks, which could be of interest to various analyses (e.g., reachability).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138409 91177308-0d34-0410-b5e6-96231b3b80d8
f1d10d939739f1a4544926d807e4f0f9fb64be61 24-Aug-2011 Ted Kremenek <kremenek@apple.com> Constify the result of CFGStmt::getStmt().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138408 91177308-0d34-0410-b5e6-96231b3b80d8
540dda6f2e4982b3eab0300c804345f5b6104c11 23-Aug-2011 Ted Kremenek <kremenek@apple.com> Fix regression in -Wuninitialized involving VLAs. It turns out that we were modeling sizeof(VLAs)
incorrectly in the CFG, and also the static analyzer. This patch regresses the analyzer a bit, but
that needs to be followed up with a better solution.

Fixes <rdar://problem/10008112>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138372 91177308-0d34-0410-b5e6-96231b3b80d8
3060178ad9df29789505c1e6debcfc80a3a13587 18-Aug-2011 Chad Rosier <mcrosier@apple.com> Fix else style. No functionality change intended.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137896 91177308-0d34-0410-b5e6-96231b3b80d8
012614ecf78442368ec82ee30efb3bc047b413e6 17-Aug-2011 Ted Kremenek <kremenek@apple.com> Fix a handful of dead stores found by Clang's static analyzer. There's a bunch of others I haven't touched.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137867 91177308-0d34-0410-b5e6-96231b3b80d8
9c378f705405d37f49795d5e915989de774fe11f 13-Aug-2011 Ted Kremenek <kremenek@apple.com> Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer and libStaticAnalyzer[*]. It was highly inconsistent, and very ugly to look at.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137537 91177308-0d34-0410-b5e6-96231b3b80d8
5290c80eba2c96aee32912adf77bea6eddb92026 12-Aug-2011 Ted Kremenek <kremenek@apple.com> Revert "Fix crash in CFGBuilder involving implicit destructor calls and gotos jumping after an object was declared. Fixes PR 10620."

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137459 91177308-0d34-0410-b5e6-96231b3b80d8
a809447c5ce90f0efe7d6b7447d4cb6812bf3429 12-Aug-2011 Ted Kremenek <kremenek@apple.com> Fix crash in CFGBuilder involving implicit destructor calls and gotos jumping after an object was declared. Fixes PR 10620.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137426 91177308-0d34-0410-b5e6-96231b3b80d8
f91a5b008d1a63630ae483247204c2651e512fa1 06-Aug-2011 Ted Kremenek <kremenek@apple.com> [analyzer] Simplify logic for ExprEngine::VisitUnaryExprOrTypeTraitExpr to avoid recursion to subexpression.

This exposed bugs in the live variables analysis, and a latent analyzer bug in the SymbolReaper.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137006 91177308-0d34-0410-b5e6-96231b3b80d8
5f9e272e632e951b1efe824cd16acb4d96077930 23-Jul-2011 Chris Lattner <sabre@nondot.org> remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
74fb1a493cf5d2dd0fb51a4eadf74e85e10a3457 19-Jul-2011 Ted Kremenek <kremenek@apple.com> Add hooks into the CFG builder to force that specific expressions are always CFGElements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135479 91177308-0d34-0410-b5e6-96231b3b80d8
03e80030515c800d1ab44125b9052dfffd1bd04c 21-Jun-2011 Douglas Gregor <dgregor@apple.com> Introduce a new AST node describing reference binding to temporaries.

MaterializeTemporaryExpr captures a reference binding to a temporary
value, making explicit that the temporary value (a prvalue) needs to
be materialized into memory so that its address can be used. The
intended AST invariant here is that a reference will always bind to a
glvalue, and MaterializeTemporaryExpr will be used to convert prvalues
into glvalues for that binding to happen. For example, given

const int& r = 1.0;

The initializer of "r" will be a MaterializeTemporaryExpr whose
subexpression is an implicit conversion from the double literal "1.0"
to an integer value.

IR generation benefits most from this new node, since it was
previously guessing (badly) when to materialize temporaries for the
purposes of reference binding. There are likely more refactoring and
cleanups we could perform there, but the introduction of
MaterializeTemporaryExpr fixes PR9565, a case where IR generation
would effectively bind a const reference directly to a bitfield in a
struct. Addresses <rdar://problem/9552231>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133521 91177308-0d34-0410-b5e6-96231b3b80d8
ac73ea8c12772fd0dcec71b83c193a2837de7f8b 10-Jun-2011 Jordy Rose <jediknil@belkadan.com> [analyzer] PR8962 again. Ban ParenExprs (and friends) from block-level expressions (by calling IgnoreParens before adding expressions to blocks). Undo 132769 (LiveVariables' local IgnoreParens), since it's no longer necessary.

Also, have Environment stop looking through NoOp casts; it didn't match the behavior of LiveVariables. And once that's gone, the whole cast block of that switch is unnecessary.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132840 91177308-0d34-0410-b5e6-96231b3b80d8
29c9e62f412c9db3ee238db2472390685a6303f3 24-May-2011 Ted Kremenek <kremenek@apple.com> Add explicit CFG support for ignoring static_asserts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132001 91177308-0d34-0410-b5e6-96231b3b80d8
8cad3046be06ea73ff8892d947697a21d7a440d3 13-May-2011 Peter Collingbourne <peter@pcc.me.uk> Refactoring of constant expression evaluator

This introduces a generic base class for the expression evaluator
classes, which handles a few common expression types which were
previously handled separately in each class. Also, the expression
evaluator now uses ConstStmtVisitor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131281 91177308-0d34-0410-b5e6-96231b3b80d8
1de85338543dd6228eb518185e385d94d377f4cb 11-May-2011 John McCall <rjmccall@apple.com> Teach CFG building how to deal with CXXMemberCallExprs and BoundMemberTy,
then teach -Wreturn-type to handle the same. Net effect: we now correctly
handle noreturn attributes on member calls in the CFG.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131178 91177308-0d34-0410-b5e6-96231b3b80d8
bc869de349227707a07ccc783344d255cf37ec16 10-May-2011 Ted Kremenek <kremenek@apple.com> Elide __label__ declarations from the CFG. This resolves a crash in CFGRecStmtDeclVisitor (crash in static analyzer).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131141 91177308-0d34-0410-b5e6-96231b3b80d8
26517e4ffe7c2c366496feb02370ba24ab5ae8f5 28-Apr-2011 Ted Kremenek <kremenek@apple.com> Remove unused method CFGBlock::hasBinaryBranchTerminator().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130336 91177308-0d34-0410-b5e6-96231b3b80d8
b403d6d746239095a2c7bac958c924d92434e2b4 18-Apr-2011 Richard Smith <richard-llvm@metafoo.co.uk> Fix PR9741. The implicit declarations created for range-based for loops weren't being added to the DeclContext (nor were they being marked as implicit). Also, the declarations were being emitted in the wrong order when building the CFG.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129700 91177308-0d34-0410-b5e6-96231b3b80d8
fc8f0e14ad142ed811e90fbd9a30e419e301c717 15-Apr-2011 Chris Lattner <sabre@nondot.org> fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129559 91177308-0d34-0410-b5e6-96231b3b80d8
ad762fcdc16b9e4705b12b09d92b8c026212b906 15-Apr-2011 Richard Smith <richard-llvm@metafoo.co.uk> Add support for C++0x's range-based for loops, as specified by the C++11 draft standard (N3291).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129541 91177308-0d34-0410-b5e6-96231b3b80d8
97e50714c262cc421f960303171d2c1afbc9bb4f 14-Apr-2011 Ted Kremenek <kremenek@apple.com> Return the correct lastly populated block from CFGBuilder::VisitUnaryExprOrTypeTraitExpr().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129499 91177308-0d34-0410-b5e6-96231b3b80d8
d40066b0fb883839a9100e5455e33190b9b8abac 05-Apr-2011 Ted Kremenek <kremenek@apple.com> Fix PR 9626 (duplicated self-init warnings under -Wuninitialized) with numerous CFG and UninitializedValues analysis changes:

1) Change the CFG to include the DeclStmt for conditional variables, instead of using the condition itself as a faux DeclStmt.
2) Update ExprEngine (the static analyzer) to understand (1), so not to regress.
3) Update UninitializedValues.cpp to initialize all tracked variables to Uninitialized at the start of the function/method.
4) Only use the SelfReferenceChecker (SemaDecl.cpp) on global variables, leaving the dataflow analysis to handle other cases.

The combination of (1) and (3) allows the dataflow-based -Wuninitialized to find self-init problems when the initializer
contained control-flow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128858 91177308-0d34-0410-b5e6-96231b3b80d8
f8adeefa9e9882bff402e092024dd457f8574673 04-Apr-2011 Ted Kremenek <kremenek@apple.com> -Wuninitialized: don't warn about uninitialized variables in unreachable code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128840 91177308-0d34-0410-b5e6-96231b3b80d8
a8d459e8a68b1270b0c35fb73e8cc090b2b69e36 23-Mar-2011 Ted Kremenek <kremenek@apple.com> Fix CFG-construction bug when run from AnalysisBasedWarnings::IssueWarnings() where block-level expressions that need
to be recorded in the Stmt*->CFGBlock* map were not always done so. Fixes <rdar://problem/9171946>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128170 91177308-0d34-0410-b5e6-96231b3b80d8
432c478fe0fec3946610d5dc7905daf5fbadf47b 16-Mar-2011 Ted Kremenek <kremenek@apple.com> Teach CFGBuilder that the 'default' branch of a switch statement is dead if all enum values in a switch conditioned are handled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127727 91177308-0d34-0410-b5e6-96231b3b80d8
8026f6d82f7fa544bc0453714fe94bca62a1196e 13-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Instead of storing an ASTContext* in FunctionProtoTypes with computed noexcept specifiers, unique FunctionProtoTypes with a ContextualFoldingSet, as suggested by John McCall.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127568 91177308-0d34-0410-b5e6-96231b3b80d8
e9cd9c0016f103fd45d41d136d5d1084aa42eb75 13-Mar-2011 Ted Kremenek <kremenek@apple.com> Fix CFG assertion failure reported in PR 9467. This was due to recent changes in optimizing CFGs for switch statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127563 91177308-0d34-0410-b5e6-96231b3b80d8
60618fa7f88d5162bb5b40988b6b38d4d75d6fc6 12-Mar-2011 Sebastian Redl <sebastian.redl@getdesigned.at> Propagate the new exception information to FunctionProtoType.
Change the interface to expose the new information and deal with the enormous fallout.
Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications.
Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127537 91177308-0d34-0410-b5e6-96231b3b80d8
f4e3cfbe8abd124be6341ef5d714819b4fbd9082 11-Mar-2011 Peter Collingbourne <peter@pcc.me.uk> Add support for the OpenCL vec_step operator, by generalising and
extending the existing support for sizeof and alignof. Original
patch by Guy Benyei.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127475 91177308-0d34-0410-b5e6-96231b3b80d8
0d28d360b5559abda755e50b855ba5e59727d9cd 10-Mar-2011 Ted Kremenek <kremenek@apple.com> When doing reachability analysis for warnings issued under DiagRuntimeBehavior, don't construct a ParentMap or CFGStmtMap.
Instead, create a small set of Stmt* -> CFGBlock* mappings during CFG construction for only the statements we care about
relating to the diagnostics we want to check for reachability.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127396 91177308-0d34-0410-b5e6-96231b3b80d8
3179a45a0e91c1dcf3492222170cf4499531bb92 10-Mar-2011 Ted Kremenek <kremenek@apple.com> Require AddStmtChoice::alwaysAdd() to take a CFGBuilder& and Stmt*. Prep for functionality changes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127387 91177308-0d34-0410-b5e6-96231b3b80d8
247e9665d897a7bbbf60c1c0d3b6609c4504a961 10-Mar-2011 Ted Kremenek <kremenek@apple.com> Remove unused 'AddStmtChoice' argument to CFGBuilder::appendStmt().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127386 91177308-0d34-0410-b5e6-96231b3b80d8
b8ad5ee345fa1fdd1fa9253f2d01f69becc88a04 10-Mar-2011 Ted Kremenek <kremenek@apple.com> Rework interaction between AnalysisContext and CFG::BuildOptions to keep a BuildOptions object around instead of keeping a copy of the flags.

Moreover, change AnalysisContext to use an OwningPtr for created analysis objects instead
of directly managing them.

Finally, add a 'forcedBlkExprs' entry to CFG::BuildOptions that will be used by the
CFGBuilder to force specific expressions to be block-level expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127385 91177308-0d34-0410-b5e6-96231b3b80d8
6e40035988965340555c942d6e7afb6c7527beb1 07-Mar-2011 Ted Kremenek <kremenek@apple.com> Fix null dereference in CFGBlock::FilterEdge that was reported in PR 9412.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127176 91177308-0d34-0410-b5e6-96231b3b80d8
0498247f87ea0d716e0c2931fea812280649e33d 04-Mar-2011 Ted Kremenek <kremenek@apple.com> Correctly handle nested switch statements in CFGBuilder when on switch statement has a condition that evaluates to a constant.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126977 91177308-0d34-0410-b5e6-96231b3b80d8
c5aff4497e5bfd7523e00b87560c1a5aa65136cc 03-Mar-2011 Ted Kremenek <kremenek@apple.com> Teach CFGImplicitDtor::getDestructorDecl() about arrays of objects with destructors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126910 91177308-0d34-0410-b5e6-96231b3b80d8
697d42db6cba7a5994d955ce31be2c097902cf0c 03-Mar-2011 Ted Kremenek <kremenek@apple.com> Teach CFGImplicitDtor::getDestructorDecl() about reference types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126909 91177308-0d34-0410-b5e6-96231b3b80d8
2ae00543d6e1bd7dba0ce2dacec740bb6049a2dd 03-Mar-2011 Matt Beaumont-Gay <matthewbg@google.com> Let's go with John and Ted's preferred fix.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126907 91177308-0d34-0410-b5e6-96231b3b80d8
8e23e6d27eb8147063053e606dbda098b7b52d7e 03-Mar-2011 Matt Beaumont-Gay <matthewbg@google.com> Keep GCC from complaining about falling off the end of the function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126897 91177308-0d34-0410-b5e6-96231b3b80d8
c9f8f5a726bbb562e4b2d4b19d66e6202dcb2657 02-Mar-2011 Ted Kremenek <kremenek@apple.com> Introduce CFGImplicitDtor::isNoReturn() to query whether a destructor actually returns. Use this for -Wreturn-type to prune false positives reported in PR 6884.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126875 91177308-0d34-0410-b5e6-96231b3b80d8
e71f3d587844110d836c82250830b27b1651afdb 02-Mar-2011 Ted Kremenek <kremenek@apple.com> Teach CFGBuilder to prune trivially unreachable case statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126797 91177308-0d34-0410-b5e6-96231b3b80d8
3c0349e87cdbd7316d06d2411d86ee1086e717a5 01-Mar-2011 Ted Kremenek <kremenek@apple.com> In preparation for fixing PR 6884, rework CFGElement to have getAs<> return pointers instead of fresh CFGElements.

- Also, consoldiate getDtorKind() and getKind() into one "kind".
- Add empty getDestructorDecl() method to CFGImplicitDtor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126738 91177308-0d34-0410-b5e6-96231b3b80d8
7a17851eee37f933eb57a5af7e1a0eb455443f6a 28-Feb-2011 Anders Carlsson <andersca@mac.com> Get rid of the areExceptionsEnabled() getter from LangOptions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126598 91177308-0d34-0410-b5e6-96231b3b80d8
f226d18f0f49394cec460699f4268e32bd0ce833 24-Feb-2011 Ted Kremenek <kremenek@apple.com> Fix tiny error in CFG construction for BinaryConditionalOperators, making sure the branch always has two successors. Also teach Environment::getSVal() about OpaqueValueExprs.

This fixes a crash reported in PR9287, and also fixes a false positive involving the value of such ternary
expressions not properly getting propagated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126362 91177308-0d34-0410-b5e6-96231b3b80d8
c56c004e0b8030e8ca8614e7febe581221938b75 23-Feb-2011 Ted Kremenek <kremenek@apple.com> Teach CFGBuilder about null pointer constants in conditionals, and how they can be used to prune branches. Fixes false null pointer dereference warning in PR 8183.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126305 91177308-0d34-0410-b5e6-96231b3b80d8
6b12da9f89b7863e6fc995312355b94197b75657 21-Feb-2011 Ted Kremenek <kremenek@apple.com> Fix a CFGBuilder bug exposed on convoluted control-flow in the Linux kernel.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126149 91177308-0d34-0410-b5e6-96231b3b80d8
c1cfdf8647a499b6b3024f4bd14a236cddb23988 20-Feb-2011 Anders Carlsson <andersca@mac.com> Add a LangOptions::areExceptionsEnabled and start using it.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126062 91177308-0d34-0410-b5e6-96231b3b80d8
d40baf6a77f6353a93f181da5d1347d3730aad37 19-Feb-2011 John McCall <rjmccall@apple.com> Fix a -Wuninitialized warning; it's actually a false positive,
but it's not reasonable for the diagnostic to figure that out.
Pointed out by Benjamin Kramer.

Also clarify the logic here.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126017 91177308-0d34-0410-b5e6-96231b3b80d8
56ca35d396d8692c384c785f9aeebcf22563fe1e 17-Feb-2011 John McCall <rjmccall@apple.com> Change the representation of GNU ?: expressions to use a different expression
class and to bind the shared value using OpaqueValueExpr. This fixes an
unnoticed problem with deserialization of these expressions where the
deserialized form would lose the vital pointer-equality trait; or rather,
it fixes it because this patch also does the right thing for deserializing

Change OVEs to not be a "temporary object" in the sense that copy elision is

This new representation is not totally unawkward to work with, but I think
that's really part and parcel with the semantics we're modelling here. In
particular, it's much easier to fix things like the copy elision bug and to
make the CFG look right.

I've tried to update the analyzer to deal with this in at least some
obvious cases, and I think we get a much better CFG out, but the printing
of OpaqueValueExprs probably needs some work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125744 91177308-0d34-0410-b5e6-96231b3b80d8
ad8dcf4a9df0e24051dc31bf9e6f3cd138a34298 17-Feb-2011 Chris Lattner <sabre@nondot.org> Step #1/N of implementing support for __label__: split labels into
LabelDecl and LabelStmt. There is a 1-1 correspondence between the
two, but this simplifies a bunch of code by itself. This is because
labels are the only place where we previously had references to random
other statements, causing grief for AST serialization and other stuff.

This does cause one regression (attr(unused) doesn't silence unused
label warnings) which I'll address next.

This does fix some minor bugs:
1. "The only valid attribute " diagnostic was capitalized.
2. Various diagnostics printed as ''labelname'' instead of 'labelname'
3. This reduces duplication of label checking between functions and blocks.

Review appreciated, particularly for the cindex and template bits.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125733 91177308-0d34-0410-b5e6-96231b3b80d8
fe59b7472c06b36efb74fbb50bbdf464fa30c0d8 15-Feb-2011 Ted Kremenek <kremenek@apple.com> Fix memory leak in CFGBuilder resulting from tracking scope information using SmallVectors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125550 91177308-0d34-0410-b5e6-96231b3b80d8
7502c1d3ce8bb97bcc4f7bebef507040bd93b26f 13-Feb-2011 John McCall <rjmccall@apple.com> Give some convenient idiomatic accessors to Stmt::child_range and
Stmt::const_child_range, then make a bunch of places use them instead
of the individual iterator accessors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125450 91177308-0d34-0410-b5e6-96231b3b80d8
f4c7371fb1d3cebcfb40abad4537bb82515704ea 19-Jan-2011 John McCall <rjmccall@apple.com> Change QualType::getTypePtr() to return a const pointer, then change a
thousand other things which were (generally inadvertantly) relying on that.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123814 91177308-0d34-0410-b5e6-96231b3b80d8
cbb67480094b3bcb5b715acd827cbad55e2a204c 08-Jan-2011 Sean Hunt <scshunt@csclub.uwaterloo.ca> Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,
more accurate, and makes it make sense for it to hold a delegating constructor

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123084 91177308-0d34-0410-b5e6-96231b3b80d8
9ce5270f0aadaaf03a0cf705787f42ce9eb1194c 07-Jan-2011 Ted Kremenek <kremenek@apple.com> Fix crash in CFGBuilder on invalid code. We still need
to reject this code, but at least clang doesn't
crash anymore.

Crash reported in PR 8880.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123017 91177308-0d34-0410-b5e6-96231b3b80d8
0a3ed3143b00f237decb1288c1ff574ae09eba4e 17-Dec-2010 Ted Kremenek <kremenek@apple.com> Rename several methods/functions in the analyzer
to start with lowercase characters. No
functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122035 91177308-0d34-0410-b5e6-96231b3b80d8
892697dd2287caf7c29aaaa82909b0e90b8b63fe 16-Dec-2010 Ted Kremenek <kremenek@apple.com> Start migration of static analyzer to using the
implicit lvalue-to-rvalue casts that John McCall
recently introduced. This causes a whole bunch
of logic in the analyzer for handling lvalues
to vanish. It does, however, raise a few issues
in the analyzer w.r.t to modeling various constructs
(e.g., field accesses to compound literals).

The .c/.m analysis test cases that fail are
due to a missing lvalue-to-rvalue cast that
will get introduced into the AST. The .cpp
failures were more than I could investigate in
one go, and the patch was already getting huge.
I have XFAILED some of these tests, and they
should obviously be further investigated.

Some highlights of this patch include:

- CFG no longer requires an lvalue bit for
- StackFrameContext doesn't need an 'asLValue'
- The "VisitLValue" path from GRExprEngine has
been eliminated.

Besides the test case failures (XFAILed), there
are surely other bugs that are fallout from
this change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121960 91177308-0d34-0410-b5e6-96231b3b80d8
4765fa05b5652fcc4356371c2f481d0ea9a1b007 06-Dec-2010 John McCall <rjmccall@apple.com> Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoretical
reason this is limited to C++, and it's certainly not limited to temporaries.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120996 91177308-0d34-0410-b5e6-96231b3b80d8
00eb3f9c5b33e3d99aee1f8b75dd9c9678fdd66b 04-Dec-2010 Francois Pichet <pichet2000@gmail.com> More anonymous struct/union redesign. This one deals with anonymous field used in a constructor initializer list:

struct X {
X() : au_i1(123) {}
union {
int au_i1;
float au_f1;

clang will now deal with au_i1 explicitly as an IndirectFieldDecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120900 91177308-0d34-0410-b5e6-96231b3b80d8
f6a1648197562e0b133440d612d9af297d0a86cc 04-Dec-2010 John McCall <rjmccall@apple.com> Although we currently have explicit lvalue-to-rvalue conversions, they're
not actually frequently used, because ImpCastExprToType only creates a node
if the types differ. So explicitly create an ICE in the lvalue-to-rvalue
conversion code in DefaultFunctionArrayLvalueConversion() as well as several
other new places, and consistently deal with the consequences throughout the

In addition, introduce a new cast kind for loading an ObjCProperty l-value,
and make sure we emit those nodes whenever an ObjCProperty l-value appears
that's not on the LHS of an assignment operator.

This breaks a couple of rewriter tests, which I've x-failed until future
development occurs on the rewriter.

Ted Kremenek kindly contributed the analyzer workarounds in this patch.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120890 91177308-0d34-0410-b5e6-96231b3b80d8
5281b8ed0e395603e5ff15ecc01ee0d0dff2e0fd 24-Nov-2010 Zhongxing Xu <xuzhongxing@gmail.com> print asLValue attribute of CFGStmt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120086 91177308-0d34-0410-b5e6-96231b3b80d8
94a3dcf146451eb6b0192873e267c4cb0f6147e8 24-Nov-2010 Zhanyong Wan <wan@google.com> Refactor AddStmtChoice to make it easier to use; also add comments on how the class works. Reviewed by kremenek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120080 91177308-0d34-0410-b5e6-96231b3b80d8
36f327c309b1fb6b82f1987190f0be74000b14c1 22-Nov-2010 Zhanyong Wan <wan@google.com> Stylistic changes to CFG.cpp:

1. "no 'else' after 'return'" -- this is for conformance with the
coding standards.

2. move 'else' to the line of the previous '}' -- this is for consistency.

Reviewed by kremenek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119983 91177308-0d34-0410-b5e6-96231b3b80d8
99cae5b67b9711ca260e5b364a878a1a91183632 22-Nov-2010 Zhanyong Wan <wan@google.com> Fix PR8419. Reviewed by kremenek and xuzhongxing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119960 91177308-0d34-0410-b5e6-96231b3b80d8
e4ae4dc87fa57e3062077514964b6d75bfa1fed1 15-Nov-2010 Ted Kremenek <kremenek@apple.com> Remove invalid assertion from CFG builder. When building the CFG pieces for a ternary '?' expression,
it is possible for the confluence block to only have a single predecessor due to calls to 'noreturn'
functions. Fixes assertion failure reported in PR 8619.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119284 91177308-0d34-0410-b5e6-96231b3b80d8
249c9458e2cc5b671634baefe8517d7598883a20 14-Nov-2010 Zhongxing Xu <xuzhongxing@gmail.com> Revert r118991.

Elidable CXXConstructExpr should inhibit calling destructor for temporary
that is copied, not the one created. This is because eliding copy constructor
means that the object that was to be copied will be constructed directly in
memory the copy would be constructed in.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119044 91177308-0d34-0410-b5e6-96231b3b80d8
9a4084dc06dc1b0033c461013bee3bae74be0555 13-Nov-2010 Zhongxing Xu <xuzhongxing@gmail.com> Do not add implicit dtors for CXXBindTemporaryExpr with elidable

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118991 91177308-0d34-0410-b5e6-96231b3b80d8
3ff5b26ddd5857a50db4bfacdd198fb32eaebdac 03-Nov-2010 Zhongxing Xu <xuzhongxing@gmail.com> Do not add elidable CXXConstructExpr as block-level expr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118165 91177308-0d34-0410-b5e6-96231b3b80d8
8599e7677e067fd01d3b2ee4c0875747d367fd8e 03-Nov-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added generating destructors for temporary objects. Two cases I know of, that are not handled properly:
1. For statement: const C& c = C(0) ?: C(1) destructors generated for condition will not differ from those generated for case without prolonged lifetime of temporary,
2. There will be no destructor for constant reference member bound to temporary at the exit from constructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118158 91177308-0d34-0410-b5e6-96231b3b80d8
a725ed468585b881c43654eeb56b28554a84808a 01-Nov-2010 Zhongxing Xu <xuzhongxing@gmail.com> Explicitly handle CXXBindTemporaryExpr, CXXFunctionalCastExpr,
and ImplicitCastExpr to propagate asLValue AddStmtChoice property.
But do not propagate AlwaysAdd property.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117909 91177308-0d34-0410-b5e6-96231b3b80d8
81bc7d07b701042371a5723b6f394cd2482ed7be 01-Nov-2010 Zhongxing Xu <xuzhongxing@gmail.com> Make all CXXConstructExpr's block-level expressions. This is required by
method inlining. Temporarily fail a test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117907 91177308-0d34-0410-b5e6-96231b3b80d8
4ba72a0b28135209c435630682febe1f854ccfa6 29-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added CFGTerminator class, that holds information about CFGBlock terminator statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117642 91177308-0d34-0410-b5e6-96231b3b80d8
a1898ddd5d0e46330898930b9185b628b5cede63 27-Oct-2010 Zhongxing Xu <xuzhongxing@gmail.com> If visiting RHS causes us to finish 'Block', e.g. the RHS is a StmtExpr
containing a DoStmt, and the LHS doesn't create a new block, then we should
return RBlock. Otherwise we'll incorrectly return NULL.

Also relax an assertion in VisitWhileStmt(). Reset 'Block' when it is finished.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117436 91177308-0d34-0410-b5e6-96231b3b80d8
8c5e5d6d8a316af5a9842169f541cac49717887d 25-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added generation of destructors for member constant size arrays.
There's only one destructor call generated for each not empty array (at least for now this should be enough).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117252 91177308-0d34-0410-b5e6-96231b3b80d8
b1c52870b8c2feaa7cd112295368bec53af490a0 25-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added generation of destructors for constant size arrays.
There's only one destructor call generated for each not empty array (at least for now this should be enough).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117251 91177308-0d34-0410-b5e6-96231b3b80d8
e1667190dff025936a21e5eb43889ac93b570468 24-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> - Fixed subexpressions evaluation order for binary operators to match order in code generated with the compiler,
- Fixed test cases for unreachable code warnings produced by Sema.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117220 91177308-0d34-0410-b5e6-96231b3b80d8
4e493e0dbac2aaac04c041f3d7dee9eccfb97689 05-Oct-2010 Zhongxing Xu <xuzhongxing@gmail.com> * Simplify code
* Fix dump() to make it consistent with the test case.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115609 91177308-0d34-0410-b5e6-96231b3b80d8
7c625d8ffc20b92fff9e1690cd2484fcb6498183 05-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added support for base and member destructors in destructor.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115592 91177308-0d34-0410-b5e6-96231b3b80d8
82bc3fd823d85ee3ef9a641c0975b6ad25f55047 04-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added support for C++ initializers in CFG.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115493 91177308-0d34-0410-b5e6-96231b3b80d8
a1a5d8e75076470c35fb069b98bf2b01904b5960 01-Oct-2010 Zhongxing Xu <xuzhongxing@gmail.com> Now the whether adding implicit dtors is controlled by cmd option.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115275 91177308-0d34-0410-b5e6-96231b3b80d8
6a16a306f6226030f8d38ae7e32082888fa937a1 01-Oct-2010 Zhongxing Xu <xuzhongxing@gmail.com> The return value is never used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115272 91177308-0d34-0410-b5e6-96231b3b80d8
b6edff55db4ff240d56d33594d68a711e4b1e24a 01-Oct-2010 Zhongxing Xu <xuzhongxing@gmail.com> Use default augument.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115271 91177308-0d34-0410-b5e6-96231b3b80d8
02acdfaeb3f3805b65e4707e5dff096209adb367 01-Oct-2010 Zhongxing Xu <xuzhongxing@gmail.com> Simplify interface for addLocalScopeForStmt().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115270 91177308-0d34-0410-b5e6-96231b3b80d8
26bc70557cba0da863dfc19bb88f0db6613ec625 01-Oct-2010 Zhongxing Xu <xuzhongxing@gmail.com> The old logic would add non-struct and non C++ struct variables to the local
scope. Now we only add C++ struct with non-trivial destructor variables to the
local scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115269 91177308-0d34-0410-b5e6-96231b3b80d8
0e97bcbee9d5f7735edecbccfb5031a2f065f286 01-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added generating CFGAutomaticObjDtors for exception variable in catch statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115266 91177308-0d34-0410-b5e6-96231b3b80d8
47575f1f775f5f250be4f395fa694a7274a65f33 01-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added generating CFGAutomaticObjDtors for init statement, condition variable and implicit scope in for statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115265 91177308-0d34-0410-b5e6-96231b3b80d8
8ae6058cecba902c0069c24bdc9c26d475559291 01-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> dded generating CFGAutomaticObjDtors for condition variable and implicit scopes in switch statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115264 91177308-0d34-0410-b5e6-96231b3b80d8
05adedcb5e199e377e35f576288caf5ceed40136 01-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added generating CFGAutomaticObjDtors for condition variable and implicit scopes in while and do statements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115262 91177308-0d34-0410-b5e6-96231b3b80d8
04e046cbf7153fc261d730d460f081322d5c42f6 01-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added generating CFGAutomaticObjDtors for condition variable and implicit scopes in if statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115256 91177308-0d34-0410-b5e6-96231b3b80d8
63426e5df054d04226a5456d17d26212d8eff30e 01-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Fixed checking for trivial destructor in CFGBuilder::addLocalScopeForVarDecl. Checked type does not have to represent C++ class.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115254 91177308-0d34-0410-b5e6-96231b3b80d8
fcb72ac985c26372315fabc08d43d6f66ff906b4 01-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added:
- Adding LocalScope for CompoundStmt,
- Adding CFGAutomaticObjDtors for end of scope, return, goto, break, continue,
- Regression tests for above cases.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115252 91177308-0d34-0410-b5e6-96231b3b80d8
239a7c42df78abc7fd5611d806d5e199fec994d1 01-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added methods for adding LocalScopes and CFGAutomaticObjDtors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115237 91177308-0d34-0410-b5e6-96231b3b80d8
53de134e7b4686eed40bc031438d8a4560a2cda4 01-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added methods for inserting CFGAutomaticObjDtors to CFGBlocks,
Fixed some misspells in comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115236 91177308-0d34-0410-b5e6-96231b3b80d8
35387a0daf3a6a7f5fcfc232eb4c28f62a4a1957 01-Oct-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added:
- post-increament, distance and bool conversion methods to LocalScope::const_iterator,
- adding VarDecl to LocalScope.

Fixed some misspells in comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115227 91177308-0d34-0410-b5e6-96231b3b80d8
f1308c738dc1e7a36101d9e96071d0d241bc2ccb 25-Sep-2010 Marcin Swiderski <marcin.sfider@gmail.com> In preparation for adding generation of destructors for objects with automatic storage added:
- LocalScope class with iterator used to pointing into it,
- fat doxygen comment for LocalScope indended usage,
- BlockScopePosPair class used for storing jump targets/sources (for: goto, break, continue), that replaces raw CFGBlock pointer used earlier for this purpose.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114790 91177308-0d34-0410-b5e6-96231b3b80d8
1cff132e48e0ccc253c34e5a2fb12718bd4e7d2e 21-Sep-2010 Marcin Swiderski <marcin.sfider@gmail.com> Added:
- definitions of interfaces for CFGInitializer and CFGAutomaticObjDtor,
- support for above classes to print_elem function (renamed print_stmt),
- support for VarDecls in StmtPrinterHelper.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114403 91177308-0d34-0410-b5e6-96231b3b80d8
49b4ef364ba042f7db2ba567310fb49917ad0086 16-Sep-2010 Zhongxing Xu <xuzhongxing@gmail.com> Tidy up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114062 91177308-0d34-0410-b5e6-96231b3b80d8
b36cd3e1757fb4fcd9509f35558c847b04bef35f 16-Sep-2010 Zhongxing Xu <xuzhongxing@gmail.com> Introduce new CFGElement hierarchy to support C++ CFG, based on Marcin's patch
and discussions with Ted and Jordy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114056 91177308-0d34-0410-b5e6-96231b3b80d8
8f3b834471b158d65d490e3458fa16ba659ec105 15-Sep-2010 Ted Kremenek <kremenek@apple.com> Relax assertion in CFG builder when processing ForStmts. This fixes an assertion failure
on code containing GNU statement expressions reported in PR 8141.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113953 91177308-0d34-0410-b5e6-96231b3b80d8
6c52c7850bccb6991470668429a1e1edf01b0873 15-Sep-2010 Ted Kremenek <kremenek@apple.com> Add CFG::BuildOptions class to pass in CFG builder options under on parameter. Patch by Marcin Świderski!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113898 91177308-0d34-0410-b5e6-96231b3b80d8
44f8ef13a3af125eecd408d0fad79a4a1eda5366 14-Sep-2010 Ted Kremenek <kremenek@apple.com> Fix CFGBuilder crash reported in PR 8141.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113826 91177308-0d34-0410-b5e6-96231b3b80d8
fe255bc6dfddade15644aecead970791e96ddedc 14-Sep-2010 Ted Kremenek <kremenek@apple.com> Remove from the CFG the half-implemented support for scoping information. We decided that scope information doesn't belong in the CFG at all, since it is a lexical construct.

Patch by Marcin Świderski!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113798 91177308-0d34-0410-b5e6-96231b3b80d8
4beaa9f51b2da57c64740cef2bd1c2fdb0c325d5 10-Sep-2010 Ted Kremenek <kremenek@apple.com> Add ObjCAtSynchronizedStmt to the CFG and add GRExprEngine support (PreVisit for checkers).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113572 91177308-0d34-0410-b5e6-96231b3b80d8
be39a566a914df8561d7a1e9654708297f0908c1 09-Sep-2010 Ted Kremenek <kremenek@apple.com> Remove stray ';' and convert tabs to spaces.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113466 91177308-0d34-0410-b5e6-96231b3b80d8
ee7f84d509c6382491673883598eb9ed2d3a6a8b 09-Sep-2010 Ted Kremenek <kremenek@apple.com> Add 'filtered_pred_iterator' and 'filtered_succ_iterator' to CFGBlock. This allows a client
to selectively walk successors/predecessors based on commonly used filters. For starters, add
a filter to ignore 'default:' cases for SwitchStmts when all enum values are covered by CaseStmts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113449 91177308-0d34-0410-b5e6-96231b3b80d8
d438b3dbdcde4df4f61a99054104643e6aadf78b 06-Sep-2010 Zhongxing Xu <xuzhongxing@gmail.com> FinishBlock() is essentially doing nothing except returning '!badCFG'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113149 91177308-0d34-0410-b5e6-96231b3b80d8
1b3b7cb15cbd02b7283bbf3ce7c0e9b0da30ef9d 06-Sep-2010 Zhongxing Xu <xuzhongxing@gmail.com> Simplify CFG construction: bail out early when we have a bad CFG.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113148 91177308-0d34-0410-b5e6-96231b3b80d8
4e0cfa8eacf76f203d6ee6ce164162ccd4275ccd 31-Aug-2010 Ted Kremenek <kremenek@apple.com> Improve CFG printing support for CXXOperatorCallExpr and CXXBindTemporaryExpr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112619 91177308-0d34-0410-b5e6-96231b3b80d8
a427f1d8f0848997029d1bdc0c5c137f982f775d 31-Aug-2010 Ted Kremenek <kremenek@apple.com> Explicitly handle CXXOperatorCallExpr when building CFGs. We should treat it the same as CallExprs.

Fixes: <rdar://problem/8375510> [Boost] CFGBuilder crash in Boost.Graph

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112618 91177308-0d34-0410-b5e6-96231b3b80d8
5722b148e886dd08ef7ee49f033ebe4fd21b1b5e 31-Aug-2010 Douglas Gregor <dgregor@apple.com> Revert my lame attempt at appeasing the CFGBuilder

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112580 91177308-0d34-0410-b5e6-96231b3b80d8
35fe7eeb1284ed786ed647b34fa01fc18646b3c7 31-Aug-2010 Douglas Gregor <dgregor@apple.com> Teach the CFGBuilder not do die on CXXBindTemporaryExpr, CXXOperatorCallExpr. Fixes a Boost.Graph crasher.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112578 91177308-0d34-0410-b5e6-96231b3b80d8
47e331ed28c2536bec227c5e2fa094ab3d46eed1 28-Aug-2010 Ted Kremenek <kremenek@apple.com> Explicitly handle CXXExprWithTemporaries during CFG construction by just visiting the subexpression. While we don't do anything intelligent right now, this obviates a bogus -Wunreahable-code warning reported in PR 6130.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112334 91177308-0d34-0410-b5e6-96231b3b80d8
2de56d1d0c3a504ad1529de2677628bdfbb95cd4 25-Aug-2010 John McCall <rjmccall@apple.com> GCC didn't care for my attempt at API compatibility, so brute-force everything
to the new constants.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112047 91177308-0d34-0410-b5e6-96231b3b80d8
334c19566104d3333cf662f0017088a18eddfa81 17-Aug-2010 Ted Kremenek <kremenek@apple.com> Fix horrible CFG bug caused by a series of NullStmts appearing at the beginning of a do...while loop. This would cause
the body of the DoStmt to be disconnected from the preceding code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111283 91177308-0d34-0410-b5e6-96231b3b80d8
d173dc7825e999edab836f8215a82a96eae7c738 17-Aug-2010 Ted Kremenek <kremenek@apple.com> CFGBuilder: don't create the empty "loop back" block for DoStmts if the loop edge can never be taken.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@111282 91177308-0d34-0410-b5e6-96231b3b80d8
0fc67e2d619088945ac71e9d2590d5158650885d 05-Aug-2010 Ted Kremenek <kremenek@apple.com> Fix CFGBuilder to not blow out the stack when processing deeply nested CaseStmts. Fixes <rdar://problem/8268753>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110286 91177308-0d34-0410-b5e6-96231b3b80d8
ad5a894df1841698c824381b414630799adc26ca 03-Aug-2010 Ted Kremenek <kremenek@apple.com> Add 'AnalysisContext::getUnoptimizedCFG()' to allow clients to get access to the original
CFG without any edges pruned out because of trivially solvable conditions (e.g., 'if (0)').

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110085 91177308-0d34-0410-b5e6-96231b3b80d8
df119892cf291847d6aebb117512225a8e67c0d5 03-Jun-2010 Zhongxing Xu <xuzhongxing@gmail.com> Make addStmt always add stmt. Delegate other cases to Visit() directly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105384 91177308-0d34-0410-b5e6-96231b3b80d8
fc61d94fbdbcd2b423976e21f24d423fcd442486 03-Jun-2010 Zhongxing Xu <xuzhongxing@gmail.com> CFG: add all LHS of assingments as lvalue. This improves support for C++ reference. Patch by Jordy.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105383 91177308-0d34-0410-b5e6-96231b3b80d8
3f64a0e3be2c9408f8256bd3aa9f0ce9e268982c 21-May-2010 Ted Kremenek <kremenek@apple.com> Fix crash in CFG construction for 'break' statements appearing in statement expressions
within the increment code of a for loop.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104375 91177308-0d34-0410-b5e6-96231b3b80d8
fadebbafe622752c3c6565b53ce8cd42bbbbd90c 13-May-2010 Ted Kremenek <kremenek@apple.com> Don't add a null successor to a CFGBlock when the contents of an @synchronized statement is empty.
Fixes <rdar://problem/7979430>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@103717 91177308-0d34-0410-b5e6-96231b3b80d8
f42e3371079de333c3822a060c008bf6680677c8 01-May-2010 Ted Kremenek <kremenek@apple.com> Add null check in CFGBuilder::VisitStmt() to make CFG construction
more resilient to bad code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102793 91177308-0d34-0410-b5e6-96231b3b80d8
862b24f8e9b1a3b332399591e48b303f57f01d0a 29-Apr-2010 Ted Kremenek <kremenek@apple.com> Fix CFG crasher involving statement expressions reported in PR 6938.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@102576 91177308-0d34-0410-b5e6-96231b3b80d8
21f6d6ea71b89aeae6b9262c8cbdff7f6328e749 14-Apr-2010 Zhongxing Xu <xuzhongxing@gmail.com> Use direct assignment instead of user defined conversion.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101236 91177308-0d34-0410-b5e6-96231b3b80d8
c5354a2ecd9fdd7f2c0eb784f7932fb5126e2a01 13-Apr-2010 Zhongxing Xu <xuzhongxing@gmail.com> CFGBuilder: always add C++ member call expr as block-level expr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101127 91177308-0d34-0410-b5e6-96231b3b80d8
115c1b9cc758d15f38e1d2ad4cf07b1cacfb3115 11-Apr-2010 Ted Kremenek <kremenek@apple.com> Fix CFG bug where bases of member expressions were not always evaluated in a lvalue context. Fixes <rdar://problem/7813989>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100966 91177308-0d34-0410-b5e6-96231b3b80d8
431ac2d9c2f7596af6187daf88be411cb1ea34cf 11-Apr-2010 Ted Kremenek <kremenek@apple.com> Fix bug in AddStmtChoice:asLValue() where 'AsLValueNotAlwaysAdd' would not be treated as indicating an lvalue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100965 91177308-0d34-0410-b5e6-96231b3b80d8
7ea2136685403045f91b3a8b83e34c51ac0e082e 11-Apr-2010 Ted Kremenek <kremenek@apple.com> Sort visitor methods. No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100964 91177308-0d34-0410-b5e6-96231b3b80d8
264ba48dc98f3f843935a485d5b086f7e0fdc4f1 30-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> the big refactoring bits of PR3782.

This introduces FunctionType::ExtInfo to hold the calling convention and the
noreturn attribute. The next patch will extend it to include the regparm
attribute and fix the bug.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99920 91177308-0d34-0410-b5e6-96231b3b80d8
802c66edc5073991f2315ea84ecace1867c6027f 29-Mar-2010 Rafael Espindola <rafael.espindola@gmail.com> Be a bit more consistent in using operator->

This patch moves some methods from QualType to Type and changes the users to
use -> instead of .

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99805 91177308-0d34-0410-b5e6-96231b3b80d8
792bea97c42dabffce457cc79f6bfede9ed21712 03-Mar-2010 Benjamin Kramer <benny.kra@googlemail.com> Simplify code a bit and remove unneeded semicolons.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97654 91177308-0d34-0410-b5e6-96231b3b80d8
5ba290a12fb9390a77ea4dca3d98deb53022d182 02-Mar-2010 Ted Kremenek <kremenek@apple.com> [CFG]

After discussion with Zhongxing, don't force the initializer of DeclStmts to be
block-level expressions.

This led to some interesting fallout:


Always visit the initializer of DeclStmts (do not assume they are block-level expressions).


With initializers of DeclStmts no longer block-level expressions, this causes self-referencing initializers (e.g. 'int x = x') to no longer cause the initialized variable to be live before the DeclStmt. While this is correct, it caused BasicStore::RemoveDeadBindings() to prune off the values of these variables from the initial store (where they are set to uninitialized). The fix is to back-port some (and only some) of the lazy-binding logic from RegionStore to
BasicStore. Now the default values of local variables are determined lazily as opposed
to explicitly initialized.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97591 91177308-0d34-0410-b5e6-96231b3b80d8
910716678e8af41432f3dfb16b340168597f8c45 24-Feb-2010 Zhongxing Xu <xuzhongxing@gmail.com> Always add CallExpr as block-level expression. Inline-based interprocedural
analysis needs this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97014 91177308-0d34-0410-b5e6-96231b3b80d8
c3daac59e26b63c08208de2fbaceb1ff01be3492 22-Feb-2010 Daniel Dunbar <daniel@zuster.org> Revert "Simplify code: Succ is guaranteed to be not NULL.", which turns out to
not be guaranteed.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96782 91177308-0d34-0410-b5e6-96231b3b80d8
8414a8c82d92fa8d35ed5d479d7fd6ae8b9d1cd4 22-Feb-2010 Zhongxing Xu <xuzhongxing@gmail.com> Simplify code: Succ is guaranteed to be not NULL.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96772 91177308-0d34-0410-b5e6-96231b3b80d8
55f988efeb08b84c2dd9e4c05990b88c81fe2b58 21-Jan-2010 Mike Stump <mrs@apple.com> Improve unreachable code warnings with respect to dead binary and
unary operators.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94084 91177308-0d34-0410-b5e6-96231b3b80d8
4c45aa1b00b91847acfb082acfaced3ffa294d1d 21-Jan-2010 Mike Stump <mrs@apple.com> Speed up compilation by avoiding generating exceptional edges from
CallExprs as those edges help cause a n^2 explosion in the number of
destructor calls. Other consumers, such as static analysis, that
would like to have more a more complete CFG can select the inclusion
of those edges as CFG build time.

This also fixes up the two compilation users of CFGs to be tolerant of
having or not having those edges. All catch code is assumed be to
live if we didn't generate the exceptional edges for CallExprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94074 91177308-0d34-0410-b5e6-96231b3b80d8
b978a441c7d8bf59e7fede938e1f3b672573b443 21-Jan-2010 Mike Stump <mrs@apple.com> Add infrastructure to add base initializers and member initializers to
the CFG. WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94062 91177308-0d34-0410-b5e6-96231b3b80d8
f00cca5e05bb9ea51a3a21c8014ff9f3508d46e9 20-Jan-2010 Mike Stump <mrs@apple.com> Wire up the EH context for the catch clauses to the outer EH context. WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93963 91177308-0d34-0410-b5e6-96231b3b80d8
a1f93631a84621d77aeb627691da85a8991af188 20-Jan-2010 Mike Stump <mrs@apple.com> Add an exceptional edge from the try terminated block to the outer EH
context (try or the Exit block) when there isn't a catch (...).

Improve CFG printing for catch (...).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93962 91177308-0d34-0410-b5e6-96231b3b80d8
079bd72439448b78629a28da6b1f8abe2cdeaf4d 19-Jan-2010 Mike Stump <mrs@apple.com> Add CFG support for the start and end of scopes and infrastructure for
implicit destructor calls. WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93922 91177308-0d34-0410-b5e6-96231b3b80d8
3fa1e4b27300a4ea4cf273182d4b6427ef87f3f8 19-Jan-2010 Ted Kremenek <kremenek@apple.com> Tighten code and rework indentation of some if() branches (for readability). No functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93904 91177308-0d34-0410-b5e6-96231b3b80d8
6db0ad32fa0987ff76d4c41393991ef4b6895ea3 19-Jan-2010 Ted Kremenek <kremenek@apple.com> Remove extra space in uses of 'assert()'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93903 91177308-0d34-0410-b5e6-96231b3b80d8
021c8afbab95c71fbdd95c0b5cea36fd316281f9 19-Jan-2010 Ted Kremenek <kremenek@apple.com> Re-alphabetize cases in switch statement.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93902 91177308-0d34-0410-b5e6-96231b3b80d8
5d1d20227878cd03db8b2dd23efd4cedfe874fee 19-Jan-2010 Mike Stump <mrs@apple.com> Add try/catch CFG support. Also improve throw CFG support. WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93840 91177308-0d34-0410-b5e6-96231b3b80d8
58b87feeaedce7ef09c2931a39d82e5aea189f41 24-Dec-2009 Ted Kremenek <kremenek@apple.com> Add CFG support for the initializer of the condition variable of a ForStmt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92113 91177308-0d34-0410-b5e6-96231b3b80d8
4ec010a6ccf4db2ab2ef9e68942642d50f7f193c 24-Dec-2009 Ted Kremenek <kremenek@apple.com> CFG tweak: in a WhileStmt, the condition variable initializer is evaluated every time the condition is checked.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92111 91177308-0d34-0410-b5e6-96231b3b80d8
76525467cfe07a2cec3a4e58043ec308ae5d67a3 24-Dec-2009 Ted Kremenek <kremenek@apple.com> Add CFG support for the initializer of the condition variable of a WhileStmt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92105 91177308-0d34-0410-b5e6-96231b3b80d8
6b501ebaf172b28d6d7e1737db27f915175ad3c8 24-Dec-2009 Ted Kremenek <kremenek@apple.com> Add CFG support for the initializer of the condition variable of a SwitchStmt.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92101 91177308-0d34-0410-b5e6-96231b3b80d8
8a69366a1cd8fe1e9fd312048c0d5ce58eabeeb2 24-Dec-2009 Ted Kremenek <kremenek@apple.com> Tidy up FindSubExprAssignments to not deference the child_iterator multiple times.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92087 91177308-0d34-0410-b5e6-96231b3b80d8
61dfbecd8e6181b2ba42ffb5feede27a2bab3b8a 23-Dec-2009 Ted Kremenek <kremenek@apple.com> Add CFG support for the condition variable that can appear in IfStmts in C++ mode.
Add transfer function support in GRExprEngine for IfStmts with initialized condition variables.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91987 91177308-0d34-0410-b5e6-96231b3b80d8
852274d4257134906995cb252fb3dfd2d71deae8 16-Dec-2009 Ted Kremenek <kremenek@apple.com> Add (initial?) static analyzer support for handling C++ references.
This change was a lot bigger than I originally anticipated; among
other things it requires us storing more information in the CFG to
record what block-level expressions need to be evaluated as lvalues.

The big change is that CFGBlocks no longer contain Stmt*'s by
CFGElements. Currently CFGElements just wrap Stmt*, but they also
store a bit indicating whether the block-level expression should be
evalauted as an lvalue. DeclStmts involving the initialization of a
reference require us treating the initialization expression as an
lvalue, even though that information isn't recorded in the AST.
Conceptually this change isn't that complicated, but it required
bubbling up the data through the CFGBuilder, to GRCoreEngine, and
eventually to GRExprEngine.

The addition of CFGElement is also useful for when we want to handle
more control-flow constructs or other data we want to keep in the CFG
that isn't represented well with just a block of statements.

In GRExprEngine, this patch introduces logic for evaluating the
lvalues of references, which currently retrieves the internal "pointer
value" that the reference represents. EvalLoad does a two stage load
to catch null dereferences involving an invalid reference (although
this could possibly be caught earlier during the initialization of a

Symbols are currently symbolicated using the reference type, instead
of a pointer type, and special handling is required creating
ElementRegions that layer on SymbolicRegions (see the changes to

Along the way, the DeadStoresChecker also silences warnings involving
dead stores to references. This was the original change I introduced
(which I wrote test cases for) that I realized caused GRExprEngine to

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91501 91177308-0d34-0410-b5e6-96231b3b80d8
c768a0c46e6c064c3281d663777ee95aea8652ee 15-Dec-2009 Ted Kremenek <kremenek@apple.com> Start the ball rolling on C++ support in the static analyzer. For
now, don't construct CFGs that contain C++ try/catch statements, and
have GRExprEngine abort a path if it encounters a C++ construct it
doesn't understand (which is mostly everything at this point).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91389 91177308-0d34-0410-b5e6-96231b3b80d8
224451bf4ec994e51cdfd994eda3ed1b6a0dae3e 04-Dec-2009 Ted Kremenek <kremenek@apple.com> Include BlockDeclRefExprs in constructed CFGs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90583 91177308-0d34-0410-b5e6-96231b3b80d8
006b0eb3e11162d8c06372db813ac9f71a7a16e8 30-Nov-2009 Tobias Grosser <grosser@fim.uni-passau.de> Adapt to the DOTGraphTraits changes in LLVM.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90137 91177308-0d34-0410-b5e6-96231b3b80d8
ba5fb5a955c896815c439289fc51c03cf0635129 28-Nov-2009 Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> lib/Analysis: Remove VISIBILITY_HIDDEN from definitions in anonymous namespace

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90028 91177308-0d34-0410-b5e6-96231b3b80d8
721903eca33f6115296083aed17685eaa73d3e8c 25-Nov-2009 Ted Kremenek <kremenek@apple.com> Allow building of CFGs for ASTs that contain BlockExprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89830 91177308-0d34-0410-b5e6-96231b3b80d8
da9b30ea415af1de659524c28793e2597342f6e8 21-Oct-2009 Ted Kremenek <kremenek@apple.com> Remove stale comment and tighten code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84697 91177308-0d34-0410-b5e6-96231b3b80d8
0ba497be27170c2a23c0217366f97eeecefa1ed8 21-Oct-2009 Ted Kremenek <kremenek@apple.com> Use llvm::OwningPtr in CFGBuilder, fixing a leak on an error path.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84695 91177308-0d34-0410-b5e6-96231b3b80d8
ee82d9bdc5025b82de8ce2a4ad4685e0a8b79da9 12-Oct-2009 Ted Kremenek <kremenek@apple.com> Use a BumpPtrAllocator to allocate all aspects of CFG, including CFGBlocks, successor and predecessor vectors, etc.

Speedup: when doing 'clang-cc -analyze -dump-cfg' (without actual printing, just
CFG building) on the amalgamated SQLite source (all of SQLite in one source
file), runtime reduced by 9%.

This fixes: <rdar://problem/7250745>

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83899 91177308-0d34-0410-b5e6-96231b3b80d8
6c2497248bc4f7fd8e5fb0a206d20abbf0e16645 24-Sep-2009 Ted Kremenek <kremenek@apple.com> When building CFGs, no longer reverse the statements in the CFGBlock. Instead
have the iterators and operator[] handle the traversal of statements, as they
are stored in reverse order. Tests show this has no real performance impact, but
it does simply the CFG construction logic and will make it slightly easier to
change the allocation strategy for CFGBlocks (as we have fewer copies).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82702 91177308-0d34-0410-b5e6-96231b3b80d8
1eb4433ac451dc16f4133a88af2d002ac26c58ef 09-Sep-2009 Mike Stump <mrs@apple.com> Remove tabs, and whitespace cleanups.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
e8d6d2b9a2c5d3f0e7e0f88f54f1711bbc6c6f78 28-Aug-2009 Ted Kremenek <kremenek@apple.com> CFG construction: Abort CFG construction when processing a CompoundStmt if any
of its subexpressions resulted in a "bad CFG".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80298 91177308-0d34-0410-b5e6-96231b3b80d8
9983cc110422a2e976191a0ce6ac4f1d7b634cc0 24-Aug-2009 Douglas Gregor <dgregor@apple.com> Don't try to evaluate an expression that is type- or value-dependent while building the CFG

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79941 91177308-0d34-0410-b5e6-96231b3b80d8
6cb7c1a43b0c8f739d1f54b7fdae5ede86033496 23-Aug-2009 Benjamin Kramer <benny.kra@googlemail.com> Replace cerr with errs().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79854 91177308-0d34-0410-b5e6-96231b3b80d8
d5c3b1339e842619fc3ae79482424f901aeb89f3 20-Aug-2009 Zhongxing Xu <xuzhongxing@gmail.com> If the 'while' has an empty body, set the body to the continue target block.
Although this does not make the CFG more correct, it makes the CFG more
beautiful without multiple roots.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79509 91177308-0d34-0410-b5e6-96231b3b80d8
1d4b218fa55239f2a7350f48be14090d2753c22c 20-Aug-2009 Zhongxing Xu <xuzhongxing@gmail.com> If the body of for loop is empty, set its body to the continue target.
Otherwise we get a wrong CFG.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79507 91177308-0d34-0410-b5e6-96231b3b80d8
2455636163fdd18581d7fdae816433f886d88213 25-Jul-2009 Mike Stump <mrs@apple.com> Add noreturn as a type attribute, handle printing for them and handle
calls to noreturn function pointers when CFG building.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77089 91177308-0d34-0410-b5e6-96231b3b80d8
fadc9eaeac18b470b6dfcf9efcf5c4f8caea89bc 24-Jul-2009 Ted Kremenek <kremenek@apple.com> Add doxygen comments and simplify expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76955 91177308-0d34-0410-b5e6-96231b3b80d8
941fde8019d47c694b8483db45d5878818fa69d1 24-Jul-2009 Ted Kremenek <kremenek@apple.com> Introduce a new variant type 'TryResult' to represent the result of
TryEvaluateBool instead of using a raw 'int'. This avoids any
confusion of how 'int' converts to bool, and makes the resultant code
easier to read.

Condense a bunch of 'addSuccessor()' calls in 'if ... else' to use the
ternary operator instead.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76947 91177308-0d34-0410-b5e6-96231b3b80d8
00998a068e50945118f334c98af05ed44d7c22a6 24-Jul-2009 Mike Stump <mrs@apple.com> Refactor and push the evaluation as late as possible.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76911 91177308-0d34-0410-b5e6-96231b3b80d8
0979d80615df97c675423de631c1b884819f4712 23-Jul-2009 Mike Stump <mrs@apple.com> Improve CFG support for C++ throw expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76814 91177308-0d34-0410-b5e6-96231b3b80d8
bd0487825751230a4396952b770349d2beac60b3 22-Jul-2009 Ted Kremenek <kremenek@apple.com> Make 'SaveAndRestore' and friends reusable classes in libAnalysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76795 91177308-0d34-0410-b5e6-96231b3b80d8
22cd6581188bbbc6bedaca64ab171b1187a1c06a 21-Jul-2009 Mike Stump <mrs@apple.com> Wire up CFG improvements for __builtin_choose_expr.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76531 91177308-0d34-0410-b5e6-96231b3b80d8
8f9893a2beeacd5149bd2d3d4c6e130516915068 21-Jul-2009 Mike Stump <mrs@apple.com> Wire up CFG improvements for do { } while () when the condition is known.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76530 91177308-0d34-0410-b5e6-96231b3b80d8
fefb9f7009702befaf715e7a8debc9505c3c8634 21-Jul-2009 Mike Stump <mrs@apple.com> Wire up for statement CFG improvements for conditionals that are known.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76529 91177308-0d34-0410-b5e6-96231b3b80d8
5f20363dc8ea094b3f6139f52084beb10d6fcd85 21-Jul-2009 Mike Stump <mrs@apple.com> Wire up CFG improvements for while when the condition is known.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76522 91177308-0d34-0410-b5e6-96231b3b80d8
e5af3ce53ec58995b09381ba645ab2117a46647b 21-Jul-2009 Mike Stump <mrs@apple.com> Add yet more analysis for CFGs involving conditionals that are actually constant.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76500 91177308-0d34-0410-b5e6-96231b3b80d8
13fc08a323b29dd97a46def1e3a15bf082476efa 18-Jul-2009 Ted Kremenek <kremenek@apple.com> Fix some fallout from CFGBuilder restructuring: all expressions that we explicitly handle have the possibility to be block-level expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76277 91177308-0d34-0410-b5e6-96231b3b80d8
6dc534ecc19a045ebcfe93eefa45da509968e888 18-Jul-2009 Ted Kremenek <kremenek@apple.com> Fix possible null dereference in CFG construction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76261 91177308-0d34-0410-b5e6-96231b3b80d8
4f88063677a2d990a44bb0d5f8437d2498b91d7f 18-Jul-2009 Ted Kremenek <kremenek@apple.com> Restructure CFG builder to have just one visitor path instead of two. The result
is an algorithm that is much easier to understand and slightly more efficient.
Thanks to Mike Stump for our discussions on the CFGBuilder and his comments that
helped prompt this long needed cleanup.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76250 91177308-0d34-0410-b5e6-96231b3b80d8
3fc8ef574cdc09c613c329ee511852d219263c15 17-Jul-2009 Ted Kremenek <kremenek@apple.com> Move WalkAST logic for 'ChooseExpr' to 'VisitChooseExpr'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76205 91177308-0d34-0410-b5e6-96231b3b80d8
f34bb2eaa87aa28bcc8b6ff0dfc696cd75605b11 17-Jul-2009 Ted Kremenek <kremenek@apple.com> Move WalkAST logic for 'ConditionalOperator' into 'VisitConditionalOperator'.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76202 91177308-0d34-0410-b5e6-96231b3b80d8
b6f1d782e0dc5fad138a17e6aa0ff6f9bc4788c6 17-Jul-2009 Ted Kremenek <kremenek@apple.com> Remove stale comments.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76196 91177308-0d34-0410-b5e6-96231b3b80d8
01bc160ffccc03e4c0583acf82bd7ab80494219a 17-Jul-2009 Chris Lattner <sabre@nondot.org> clean up this code, add the fixme back.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76180 91177308-0d34-0410-b5e6-96231b3b80d8
a00425414e8c209cabc25d1826b200aeb94259af 17-Jul-2009 Zhongxing Xu <xuzhongxing@gmail.com> Refactor code into a new CallExpr::getDirectCallee() method. Simplify some
code with the new method.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76164 91177308-0d34-0410-b5e6-96231b3b80d8
6d9828c82c9321f042ab416fd2ffaa3034347d45 17-Jul-2009 Mike Stump <mrs@apple.com> Fixup indentation of rest of switch statement to match llvm coding
conventions. Also reflowed comments and removed spaces at end of
lines and fixed up 80 col violations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76140 91177308-0d34-0410-b5e6-96231b3b80d8
cd7bf230a77c550115e4a78ee371fc49a7563692 17-Jul-2009 Mike Stump <mrs@apple.com> Make noreturn functions alter the CFG.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76133 91177308-0d34-0410-b5e6-96231b3b80d8
e41611aa2237d06a0ef61db4528fb2883a8defcd 16-Jul-2009 Ted Kremenek <kremenek@apple.com> Move the source-level CFG from libAST to libAnalysis.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76092 91177308-0d34-0410-b5e6-96231b3b80d8