Commit Graph

395 Commits

Author SHA1 Message Date
Ted Kremenek c56c004e0b 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
2011-02-23 05:11:46 +00:00
Ted Kremenek 6b12da9f89 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
2011-02-21 22:11:26 +00:00
Anders Carlsson c1cfdf8647 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
2011-02-20 00:20:27 +00:00
John McCall d40baf6a77 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
2011-02-19 03:13:26 +00:00
John McCall 56ca35d396 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
OVEs.

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

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
2011-02-17 10:25:35 +00:00
Chris Lattner ad8dcf4a9d 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
2011-02-17 07:39:24 +00:00
Ted Kremenek fe59b7472c 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
2011-02-15 02:47:45 +00:00
John McCall 7502c1d3ce 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
2011-02-13 04:07:26 +00:00
John McCall f4c7371fb1 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
2011-01-19 06:33:43 +00:00
Sean Hunt cbb6748009 Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,
more accurate, and makes it make sense for it to hold a delegating constructor
call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123084 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 20:30:50 +00:00
Ted Kremenek 9ce5270f0a 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
2011-01-07 19:37:16 +00:00
Ted Kremenek 0a3ed3143b 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
2010-12-17 04:44:39 +00:00
Ted Kremenek 892697dd22 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
  CFGElements
- StackFrameContext doesn't need an 'asLValue'
  flag
- 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
2010-12-16 07:46:53 +00:00
John McCall 4765fa05b5 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
2010-12-06 08:20:24 +00:00
Francois Pichet 00eb3f9c5b 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
2010-12-04 09:14:42 +00:00
John McCall f6a1648197 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
compiler.

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
2010-12-04 03:47:34 +00:00
Zhongxing Xu 5281b8ed0e print asLValue attribute of CFGStmt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24 06:33:02 +00:00
Zhanyong Wan 94a3dcf146 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
2010-11-24 03:28:53 +00:00
Zhanyong Wan 36f327c309 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
2010-11-22 19:32:14 +00:00
Zhanyong Wan 99cae5b67b Fix PR8419. Reviewed by kremenek and xuzhongxing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119960 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-22 08:45:56 +00:00
Ted Kremenek e4ae4dc87f 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
2010-11-15 22:59:22 +00:00
Zhongxing Xu 249c9458e2 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
2010-11-14 15:23:50 +00:00
Zhongxing Xu 9a4084dc06 Do not add implicit dtors for CXXBindTemporaryExpr with elidable
CXXConstructExpr.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118991 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13 07:30:59 +00:00
Zhongxing Xu 3ff5b26ddd 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
2010-11-03 11:14:06 +00:00
Marcin Swiderski 8599e7677e 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
2010-11-03 06:19:35 +00:00
Zhongxing Xu a725ed4685 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
2010-11-01 13:04:58 +00:00
Zhongxing Xu 81bc7d07b7 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
2010-11-01 06:46:05 +00:00
Marcin Swiderski 4ba72a0b28 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
2010-10-29 05:21:47 +00:00
Zhongxing Xu a1898ddd5d 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
2010-10-27 03:23:10 +00:00
Marcin Swiderski 8c5e5d6d8a 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
2010-10-25 07:05:54 +00:00
Marcin Swiderski b1c52870b8 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
2010-10-25 07:00:40 +00:00
Marcin Swiderski e1667190df - 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
2010-10-24 08:21:40 +00:00
Zhongxing Xu 4e493e0dba * 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
2010-10-05 08:38:06 +00:00
Marcin Swiderski 7c625d8ffc 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
2010-10-05 05:37:00 +00:00
Marcin Swiderski 82bc3fd823 Added support for C++ initializers in CFG.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115493 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-04 03:38:22 +00:00
Zhongxing Xu a1a5d8e750 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
2010-10-01 03:31:06 +00:00
Zhongxing Xu 6a16a306f6 The return value is never used.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115272 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-01 03:22:39 +00:00
Zhongxing Xu b6edff55db Use default augument.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115271 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-01 03:09:09 +00:00
Zhongxing Xu 02acdfaeb3 Simplify interface for addLocalScopeForStmt().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-01 03:00:16 +00:00
Zhongxing Xu 26bc70557c 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
2010-10-01 02:47:11 +00:00
Marcin Swiderski 0e97bcbee9 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
2010-10-01 01:46:52 +00:00
Marcin Swiderski 47575f1f77 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
2010-10-01 01:38:14 +00:00
Marcin Swiderski 8ae6058cec 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
2010-10-01 01:24:41 +00:00
Marcin Swiderski 05adedcb5e 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
2010-10-01 01:14:17 +00:00
Marcin Swiderski 04e046cbf7 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
2010-10-01 00:52:17 +00:00
Marcin Swiderski 63426e5df0 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
2010-10-01 00:31:22 +00:00
Marcin Swiderski fcb72ac985 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
2010-10-01 00:23:17 +00:00
Marcin Swiderski 239a7c42df Added methods for adding LocalScopes and CFGAutomaticObjDtors.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115237 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 23:05:00 +00:00
Marcin Swiderski 53de134e7b 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
2010-09-30 22:54:37 +00:00
Marcin Swiderski 35387a0daf 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
2010-09-30 22:42:32 +00:00
Marcin Swiderski f1308c738d 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
2010-09-25 11:05:21 +00:00
Marcin Swiderski 1cff132e48 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
2010-09-21 05:58:15 +00:00
Zhongxing Xu 49b4ef364b Tidy up.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114062 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 03:28:18 +00:00
Zhongxing Xu b36cd3e175 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
2010-09-16 01:25:47 +00:00
Ted Kremenek 8f3b834471 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
2010-09-15 07:01:20 +00:00
Ted Kremenek 6c52c7850b 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
2010-09-14 23:41:16 +00:00
Ted Kremenek 44f8ef13a3 Fix CFGBuilder crash reported in PR 8141.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113826 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14 01:13:32 +00:00
Ted Kremenek fe255bc6df 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
2010-09-13 22:25:54 +00:00
Ted Kremenek 4beaa9f51b 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
2010-09-10 03:05:33 +00:00
Ted Kremenek be39a566a9 Remove stray ';' and convert tabs to spaces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113466 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 02:57:48 +00:00
Ted Kremenek ee7f84d509 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
2010-09-09 00:06:04 +00:00
Zhongxing Xu d438b3dbdc 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
2010-09-06 07:32:31 +00:00
Zhongxing Xu 1b3b7cb15c 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
2010-09-06 07:04:06 +00:00
Ted Kremenek 4e0cfa8eac 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
2010-08-31 18:47:37 +00:00
Ted Kremenek a427f1d8f0 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
2010-08-31 18:47:34 +00:00
Douglas Gregor 5722b148e8 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
2010-08-31 05:36:56 +00:00
Douglas Gregor 35fe7eeb12 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
2010-08-31 05:10:27 +00:00
Ted Kremenek 47e331ed28 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
2010-08-28 00:19:02 +00:00
John McCall 2de56d1d0c 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
2010-08-25 11:45:40 +00:00
Ted Kremenek 334c195661 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
2010-08-17 21:00:06 +00:00
Ted Kremenek d173dc7825 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
2010-08-17 20:59:56 +00:00
Ted Kremenek 0fc67e2d61 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
2010-08-04 23:54:30 +00:00
Ted Kremenek ad5a894df1 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
2010-08-02 23:46:59 +00:00
Zhongxing Xu df119892cf 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
2010-06-03 06:43:23 +00:00
Zhongxing Xu fc61d94fbd 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
2010-06-03 06:23:18 +00:00
Ted Kremenek 3f64a0e3be 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
2010-05-21 20:30:15 +00:00
Ted Kremenek fadebbafe6 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
2010-05-13 16:38:08 +00:00
Ted Kremenek f42e337107 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
2010-04-30 22:25:53 +00:00
Ted Kremenek 862b24f8e9 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
2010-04-29 01:10:26 +00:00
Zhongxing Xu 21f6d6ea71 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
2010-04-14 05:50:04 +00:00
Zhongxing Xu c5354a2ecd 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
2010-04-13 09:38:01 +00:00
Ted Kremenek 115c1b9cc7 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
2010-04-11 17:02:10 +00:00
Ted Kremenek 431ac2d9c2 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
2010-04-11 17:02:04 +00:00
Ted Kremenek 7ea2136685 Sort visitor methods. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100964 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-11 17:01:59 +00:00
Rafael Espindola 264ba48dc9 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
2010-03-30 20:24:48 +00:00
Rafael Espindola 802c66edc5 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
2010-03-29 03:39:46 +00:00
Benjamin Kramer 792bea97c4 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
2010-03-03 16:28:47 +00:00
Ted Kremenek 5ba290a12f [CFG]
After discussion with Zhongxing, don't force the initializer of DeclStmts to be
block-level expressions.

This led to some interesting fallout:

[UninitializedValues]

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

[BasicStore]

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
2010-03-02 21:43:54 +00:00
Zhongxing Xu 910716678e 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
2010-02-24 02:19:28 +00:00
Daniel Dunbar c3daac59e2 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
2010-02-22 05:58:59 +00:00
Zhongxing Xu 8414a8c82d 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
2010-02-22 02:59:27 +00:00
Mike Stump 55f988efeb 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
2010-01-21 17:21:23 +00:00
Mike Stump 4c45aa1b00 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
2010-01-21 15:20:48 +00:00
Mike Stump b978a441c7 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
2010-01-21 02:21:40 +00:00
Mike Stump f00cca5e05 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
2010-01-20 01:30:58 +00:00
Mike Stump a1f93631a8 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
2010-01-20 01:15:34 +00:00
Mike Stump 079bd72439 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
2010-01-19 22:00:14 +00:00
Ted Kremenek 3fa1e4b273 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
2010-01-19 20:52:05 +00:00
Ted Kremenek 6db0ad32fa Remove extra space in uses of 'assert()'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93903 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 20:46:35 +00:00
Ted Kremenek 021c8afbab Re-alphabetize cases in switch statement.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93902 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-19 20:40:33 +00:00
Mike Stump 5d1d202278 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
2010-01-19 02:20:09 +00:00
Ted Kremenek 58b87feeae 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
2009-12-24 01:49:06 +00:00
Ted Kremenek 4ec010a6cc 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
2009-12-24 01:34:10 +00:00
Ted Kremenek 76525467cf 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
2009-12-24 00:54:37 +00:00
Ted Kremenek 6b501ebaf1 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
2009-12-24 00:39:26 +00:00
Ted Kremenek 8a69366a1c 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
2009-12-23 23:37:10 +00:00
Ted Kremenek 61dfbecd8e 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
2009-12-23 04:49:01 +00:00
Ted Kremenek 852274d425 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
reference).

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
RegionStoreManager).

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
crash.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91501 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-16 03:18:58 +00:00
Ted Kremenek c768a0c46e 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
2009-12-15 01:38:04 +00:00
Ted Kremenek 224451bf4e Include BlockDeclRefExprs in constructed CFGs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90583 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-04 20:33:25 +00:00
Tobias Grosser 006b0eb3e1 Adapt to the DOTGraphTraits changes in LLVM.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90137 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-30 14:16:05 +00:00
Kovarththanan Rajaratnam ba5fb5a955 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
2009-11-28 06:07:30 +00:00
Ted Kremenek 721903eca3 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
2009-11-25 01:34:30 +00:00
Ted Kremenek da9b30ea41 Remove stale comment and tighten code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84697 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-20 23:59:28 +00:00
Ted Kremenek 0ba497be27 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
2009-10-20 23:46:25 +00:00
Ted Kremenek ee82d9bdc5 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
2009-10-12 20:55:07 +00:00
Ted Kremenek 6c2497248b 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
2009-09-24 18:45:41 +00:00
Mike Stump 1eb4433ac4 Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-09 15:08:12 +00:00
Ted Kremenek e8d6d2b9a2 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
2009-08-27 23:16:26 +00:00
Douglas Gregor 9983cc1104 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
2009-08-24 21:39:56 +00:00
Benjamin Kramer 6cb7c1a43b Replace cerr with errs().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79854 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 12:08:50 +00:00
Zhongxing Xu d5c3b1339e 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
2009-08-20 03:21:49 +00:00
Zhongxing Xu 1d4b218fa5 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
2009-08-20 02:56:48 +00:00
Mike Stump 2455636163 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
2009-07-25 21:26:53 +00:00
Ted Kremenek fadc9eaeac Add doxygen comments and simplify expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76955 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-24 06:55:42 +00:00
Ted Kremenek 941fde8019 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
2009-07-24 04:47:11 +00:00
Mike Stump 00998a068e 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
2009-07-23 23:25:26 +00:00
Mike Stump 0979d80615 Improve CFG support for C++ throw expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76814 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-22 22:56:04 +00:00
Ted Kremenek bd04878257 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
2009-07-22 21:45:16 +00:00
Mike Stump 22cd658118 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
2009-07-21 01:46:17 +00:00
Mike Stump 8f9893a2be 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
2009-07-21 01:27:50 +00:00
Mike Stump fefb9f7009 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
2009-07-21 01:12:51 +00:00
Mike Stump 5f20363dc8 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
2009-07-21 00:38:52 +00:00
Mike Stump e5af3ce53e 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
2009-07-20 23:24:15 +00:00
Ted Kremenek 13fc08a323 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
2009-07-18 00:47:21 +00:00
Ted Kremenek 6dc534ecc1 Fix possible null dereference in CFG construction.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76261 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 22:57:50 +00:00
Ted Kremenek 4f88063677 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
2009-07-17 22:18:43 +00:00
Ted Kremenek 3fc8ef574c Move WalkAST logic for 'ChooseExpr' to 'VisitChooseExpr'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76205 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 18:20:32 +00:00
Ted Kremenek f34bb2eaa8 Move WalkAST logic for 'ConditionalOperator' into 'VisitConditionalOperator'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76202 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 18:15:54 +00:00
Ted Kremenek b6f1d782e0 Remove stale comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76196 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 18:04:55 +00:00
Chris Lattner 01bc160ffc 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
2009-07-17 15:50:19 +00:00
Zhongxing Xu a00425414e 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
2009-07-17 07:29:51 +00:00
Mike Stump 6d9828c82c 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
2009-07-17 01:31:16 +00:00
Mike Stump cd7bf230a7 Make noreturn functions alter the CFG.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76133 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-17 01:04:31 +00:00
Ted Kremenek e41611aa22 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
2009-07-16 18:13:04 +00:00