Commit Graph

1993 Commits

Author SHA1 Message Date
Ted Kremenek 9e618ed1c9 Fix range in printf warnings for invalid conversion specifiers.
llvm-svn: 120735
2010-12-02 20:57:51 +00:00
Zhongxing Xu a1a9ba11b7 Let StackFrameContext represent if the call expr is evaluated as lvalue.
This is required for supporting const reference to temporary objects.

llvm-svn: 120093
2010-11-24 13:08:51 +00:00
Zhongxing Xu 9b6e6b087f print asLValue attribute of CFGStmt.
llvm-svn: 120086
2010-11-24 06:33:02 +00:00
Zhanyong Wan b5d11c127a Refactor AddStmtChoice to make it easier to use; also add comments on how the class works. Reviewed by kremenek.
llvm-svn: 120080
2010-11-24 03:28:53 +00:00
Zhanyong Wan 59f09c7483 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.

llvm-svn: 119983
2010-11-22 19:32:14 +00:00
Zhanyong Wan 6dace61730 Fix PR8419. Reviewed by kremenek and xuzhongxing.
llvm-svn: 119960
2010-11-22 08:45:56 +00:00
Anders Carlsson a369f8dc3a The 'X' printf type has a valid alternative form. Fixes PR8641.
llvm-svn: 119946
2010-11-21 18:34:21 +00:00
Ted Kremenek 18fb1665bf 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.

llvm-svn: 119284
2010-11-15 22:59:22 +00:00
Zhongxing Xu fee455fcf5 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.

llvm-svn: 119044
2010-11-14 15:23:50 +00:00
Zhongxing Xu 1b038fa00f Do not add implicit dtors for CXXBindTemporaryExpr with elidable
CXXConstructExpr.

llvm-svn: 118991
2010-11-13 07:30:59 +00:00
Anders Carlsson 3fd50319d3 Don't warn when matching %p to nullptr.
llvm-svn: 118344
2010-11-06 14:58:53 +00:00
Zhongxing Xu fb2f8164ae Do not add elidable CXXConstructExpr as block-level expr.
llvm-svn: 118165
2010-11-03 11:14:06 +00:00
Marcin Swiderski 3ab17ad8ec 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.

llvm-svn: 118158
2010-11-03 06:19:35 +00:00
Zhongxing Xu e1dbeb28da Explicitly handle CXXBindTemporaryExpr, CXXFunctionalCastExpr,
and ImplicitCastExpr to propagate asLValue AddStmtChoice property.
But do not propagate AlwaysAdd property.

llvm-svn: 117909
2010-11-01 13:04:58 +00:00
Zhongxing Xu 0b51d4db8c Make all CXXConstructExpr's block-level expressions. This is required by
method inlining. Temporarily fail a test case.

llvm-svn: 117907
2010-11-01 06:46:05 +00:00
Marcin Swiderski a7d84a7615 Added CFGTerminator class, that holds information about CFGBlock terminator statement.
llvm-svn: 117642
2010-10-29 05:21:47 +00:00
Zhongxing Xu d95ccd58a9 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.

llvm-svn: 117436
2010-10-27 03:23:10 +00:00
Marcin Swiderski 01769904d3 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).

llvm-svn: 117252
2010-10-25 07:05:54 +00:00
Marcin Swiderski 52e4bc1fed 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).

llvm-svn: 117251
2010-10-25 07:00:40 +00:00
Marcin Swiderski 772324971d - 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.

llvm-svn: 117220
2010-10-24 08:21:40 +00:00
Ted Kremenek 12a37de003 Previously, the printf warnings would say your arguments type was 'int' when it was really a 'char'
or a 'short'. This fixes that and allows the hints to suggest 'h' modifiers for small ints.

Patch by Justin Bogner!

llvm-svn: 116996
2010-10-21 04:00:58 +00:00
John McCall 1c9c3fd50a Death to blocks, or at least the word "block" in one particular obnoxiously
ambiguous context.

llvm-svn: 116567
2010-10-15 04:57:14 +00:00
Zhongxing Xu 614e17dddf * Simplify code
* Fix dump() to make it consistent with the test case.

llvm-svn: 115609
2010-10-05 08:38:06 +00:00
Marcin Swiderski 20b88739ed Added support for base and member destructors in destructor.
llvm-svn: 115592
2010-10-05 05:37:00 +00:00
Marcin Swiderski 87b1bb6fd2 Added support for C++ initializers in CFG.
llvm-svn: 115493
2010-10-04 03:38:22 +00:00
Zhongxing Xu b06a2cdd2b Now the whether adding implicit dtors is controlled by cmd option.
llvm-svn: 115275
2010-10-01 03:31:06 +00:00
Zhongxing Xu 6d372f7c0f The return value is never used.
llvm-svn: 115272
2010-10-01 03:22:39 +00:00
Zhongxing Xu 307701e1b4 Use default augument.
llvm-svn: 115271
2010-10-01 03:09:09 +00:00
Zhongxing Xu 81714f2196 Simplify interface for addLocalScopeForStmt().
llvm-svn: 115270
2010-10-01 03:00:16 +00:00
Zhongxing Xu ea360a3b1a 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.

llvm-svn: 115269
2010-10-01 02:47:11 +00:00
Marcin Swiderski 3546b1aea1 Added generating CFGAutomaticObjDtors for exception variable in catch statement.
llvm-svn: 115266
2010-10-01 01:46:52 +00:00
Marcin Swiderski 6d5ee0c7f9 Added generating CFGAutomaticObjDtors for init statement, condition variable and implicit scope in for statement.
llvm-svn: 115265
2010-10-01 01:38:14 +00:00
Marcin Swiderski e407a3ba1e dded generating CFGAutomaticObjDtors for condition variable and implicit scopes in switch statement.
llvm-svn: 115264
2010-10-01 01:24:41 +00:00
Marcin Swiderski 1f4e15c56f Added generating CFGAutomaticObjDtors for condition variable and implicit scopes in while and do statements.
llvm-svn: 115262
2010-10-01 01:14:17 +00:00
Marcin Swiderski f883ade880 Added generating CFGAutomaticObjDtors for condition variable and implicit scopes in if statement.
llvm-svn: 115256
2010-10-01 00:52:17 +00:00
Marcin Swiderski e84cb97997 Fixed checking for trivial destructor in CFGBuilder::addLocalScopeForVarDecl. Checked type does not have to represent C++ class.
llvm-svn: 115254
2010-10-01 00:31:22 +00:00
Marcin Swiderski 667ffecd9e Added:
- Adding LocalScope for CompoundStmt,
- Adding CFGAutomaticObjDtors for end of scope, return, goto, break, continue,
- Regression tests for above cases.

llvm-svn: 115252
2010-10-01 00:23:17 +00:00
Marcin Swiderski 5e41573d26 Added methods for adding LocalScopes and CFGAutomaticObjDtors.
llvm-svn: 115237
2010-09-30 23:05:00 +00:00
Marcin Swiderski 321a707c9c Added methods for inserting CFGAutomaticObjDtors to CFGBlocks,
Fixed some misspells in comments.

llvm-svn: 115236
2010-09-30 22:54:37 +00:00
Marcin Swiderski e9862ce90a Added:
- post-increament, distance and bool conversion methods to LocalScope::const_iterator,
- adding VarDecl to LocalScope.

Fixed some misspells in comments.

llvm-svn: 115227
2010-09-30 22:42:32 +00:00
Marcin Swiderski 99a9040a1f Added two new command line arguments:
-cfg-add-implicit-dtors - sets CFG::BuildOptions::AddImplicitDtors for AnalysisCosumer to true,
-cfg-add-initializers - sets CFG::BuildOptions::AddInitializers for AnalysisCosumer to true.

llvm-svn: 115142
2010-09-30 07:41:24 +00:00
Marcin Swiderski 8b99b8a782 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.

llvm-svn: 114790
2010-09-25 11:05:21 +00:00
Marcin Swiderski c0ca7316bc Added:
- definitions of interfaces for CFGInitializer and CFGAutomaticObjDtor,
- support for above classes to print_elem function (renamed print_stmt),
- support for VarDecls in StmtPrinterHelper.

llvm-svn: 114403
2010-09-21 05:58:15 +00:00
Zhongxing Xu d38fb8466c Tidy up.
llvm-svn: 114062
2010-09-16 03:28:18 +00:00
Zhongxing Xu 2cd7a78c76 Introduce new CFGElement hierarchy to support C++ CFG, based on Marcin's patch
and discussions with Ted and Jordy.

llvm-svn: 114056
2010-09-16 01:25:47 +00:00
Ted Kremenek 7b31a61d10 Relax assertion in CFG builder when processing ForStmts. This fixes an assertion failure
on code containing GNU statement expressions reported in PR 8141.

llvm-svn: 113953
2010-09-15 07:01:20 +00:00
Ted Kremenek e97b1ebef1 Add CFG::BuildOptions class to pass in CFG builder options under on parameter. Patch by Marcin Świderski!
llvm-svn: 113898
2010-09-14 23:41:16 +00:00
Ted Kremenek 8abff774aa Fix CFGBuilder crash reported in PR 8141.
llvm-svn: 113826
2010-09-14 01:13:32 +00:00
Michael J. Spencer 09476212de Revert "CMake: Update to use standard CMake dependency tracking facilities instead"
This reverts commit r113631

Conflicts:

	CMakeLists.txt
	lib/CodeGen/CMakeLists.txt

llvm-svn: 113817
2010-09-13 23:54:41 +00:00
Ted Kremenek 35965b972e 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!

llvm-svn: 113798
2010-09-13 22:25:54 +00:00