summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis/CFG.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Let's go with John and Ted's preferred fix.Matt Beaumont-Gay2011-03-031-1/+2
| | | | llvm-svn: 126907
* Keep GCC from complaining about falling off the end of the function.Matt Beaumont-Gay2011-03-021-0/+1
| | | | llvm-svn: 126897
* Introduce CFGImplicitDtor::isNoReturn() to query whether a destructor ↵Ted Kremenek2011-03-021-1/+34
| | | | | | actually returns. Use this for -Wreturn-type to prune false positives reported in PR 6884. llvm-svn: 126875
* Teach CFGBuilder to prune trivially unreachable case statements.Ted Kremenek2011-03-011-38/+106
| | | | llvm-svn: 126797
* In preparation for fixing PR 6884, rework CFGElement to have getAs<> return ↵Ted Kremenek2011-03-011-46/+70
| | | | | | | | | pointers instead of fresh CFGElements. - Also, consoldiate getDtorKind() and getKind() into one "kind". - Add empty getDestructorDecl() method to CFGImplicitDtor. llvm-svn: 126738
* Get rid of the areExceptionsEnabled() getter from LangOptions.Anders Carlsson2011-02-281-1/+1
| | | | llvm-svn: 126598
* Fix tiny error in CFG construction for BinaryConditionalOperators, making ↵Ted Kremenek2011-02-241-12/+14
| | | | | | | | | 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. llvm-svn: 126362
* Teach CFGBuilder about null pointer constants in conditionals, and how they ↵Ted Kremenek2011-02-231-3/+11
| | | | | | can be used to prune branches. Fixes false null pointer dereference warning in PR 8183. llvm-svn: 126305
* Fix a CFGBuilder bug exposed on convoluted control-flow in the Linux kernel.Ted Kremenek2011-02-211-5/+8
| | | | llvm-svn: 126149
* Add a LangOptions::areExceptionsEnabled and start using it.Anders Carlsson2011-02-201-1/+1
| | | | llvm-svn: 126062
* Fix a -Wuninitialized warning; it's actually a false positive,John McCall2011-02-191-2/+10
| | | | | | | | | but it's not reasonable for the diagnostic to figure that out. Pointed out by Benjamin Kramer. Also clarify the logic here. llvm-svn: 126017
* Change the representation of GNU ?: expressions to use a different expressionJohn McCall2011-02-171-43/+45
| | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 125744
* Step #1/N of implementing support for __label__: split labels intoChris Lattner2011-02-171-12/+13
| | | | | | | | | | | | | | | | | | | 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. llvm-svn: 125733
* Fix memory leak in CFGBuilder resulting from tracking scope information ↵Ted Kremenek2011-02-151-7/+10
| | | | | | using SmallVectors. llvm-svn: 125550
* Give some convenient idiomatic accessors to Stmt::child_range andJohn McCall2011-02-131-6/+4
| | | | | | | Stmt::const_child_range, then make a bunch of places use them instead of the individual iterator accessors. llvm-svn: 125450
* Change QualType::getTypePtr() to return a const pointer, then change aJohn McCall2011-01-191-6/+6
| | | | | | thousand other things which were (generally inadvertantly) relying on that. llvm-svn: 123814
* Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,Alexis Hunt2011-01-081-4/+4
| | | | | | | more accurate, and makes it make sense for it to hold a delegating constructor call. llvm-svn: 123084
* Fix crash in CFGBuilder on invalid code. We still needTed Kremenek2011-01-071-20/+23
| | | | | | | | | to reject this code, but at least clang doesn't crash anymore. Crash reported in PR 8880. llvm-svn: 123017
* Rename several methods/functions in the analyzerTed Kremenek2010-12-171-78/+78
| | | | | | | to start with lowercase characters. No functionality change. llvm-svn: 122035
* Start migration of static analyzer to using theTed Kremenek2010-12-161-87/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 121960
* Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall2010-12-061-10/+10
| | | | | | reason this is limited to C++, and it's certainly not limited to temporaries. llvm-svn: 120996
* More anonymous struct/union redesign. This one deals with anonymous field ↵Francois Pichet2010-12-041-2/+2
| | | | | | | | | | | | | | | | 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. llvm-svn: 120900
* Although we currently have explicit lvalue-to-rvalue conversions, they'reJohn McCall2010-12-041-2/+19
| | | | | | | | | | | | | | | | | | | 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. llvm-svn: 120890
* print asLValue attribute of CFGStmt.Zhongxing Xu2010-11-241-0/+3
| | | | llvm-svn: 120086
* Refactor AddStmtChoice to make it easier to use; also add comments on how ↵Zhanyong Wan2010-11-241-49/+57
| | | | | | the class works. Reviewed by kremenek. llvm-svn: 120080
* Stylistic changes to CFG.cpp:Zhanyong Wan2010-11-221-24/+22
| | | | | | | | | | | 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
* Fix PR8419. Reviewed by kremenek and xuzhongxing.Zhanyong Wan2010-11-221-0/+17
| | | | llvm-svn: 119960
* Remove invalid assertion from CFG builder. When building the CFG pieces for ↵Ted Kremenek2010-11-151-1/+2
| | | | | | | | | 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
* Revert r118991.Zhongxing Xu2010-11-141-8/+1
| | | | | | | | | 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
* Do not add implicit dtors for CXXBindTemporaryExpr with elidable Zhongxing Xu2010-11-131-1/+8
| | | | | | CXXConstructExpr. llvm-svn: 118991
* Do not add elidable CXXConstructExpr as block-level expr.Zhongxing Xu2010-11-031-1/+2
| | | | llvm-svn: 118165
* Added generating destructors for temporary objects. Two cases I know of, ↵Marcin Swiderski2010-11-031-31/+295
| | | | | | | | | 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
* Explicitly handle CXXBindTemporaryExpr, CXXFunctionalCastExpr, Zhongxing Xu2010-11-011-0/+51
| | | | | | | and ImplicitCastExpr to propagate asLValue AddStmtChoice property. But do not propagate AlwaysAdd property. llvm-svn: 117909
* Make all CXXConstructExpr's block-level expressions. This is required by Zhongxing Xu2010-11-011-1/+28
| | | | | | method inlining. Temporarily fail a test case. llvm-svn: 117907
* Added CFGTerminator class, that holds information about CFGBlock terminator ↵Marcin Swiderski2010-10-291-5/+5
| | | | | | statement. llvm-svn: 117642
* If visiting RHS causes us to finish 'Block', e.g. the RHS is a StmtExprZhongxing Xu2010-10-271-3/+8
| | | | | | | | | 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
* Added generation of destructors for member constant size arrays.Marcin Swiderski2010-10-251-2/+15
| | | | | | There's only one destructor call generated for each not empty array (at least for now this should be enough). llvm-svn: 117252
* Added generation of destructors for constant size arrays.Marcin Swiderski2010-10-251-2/+10
| | | | | | There's only one destructor call generated for each not empty array (at least for now this should be enough). llvm-svn: 117251
* - Fixed subexpressions evaluation order for binary operators to match order ↵Marcin Swiderski2010-10-241-7/+9
| | | | | | | | in code generated with the compiler, - Fixed test cases for unreachable code warnings produced by Sema. llvm-svn: 117220
* * Simplify codeZhongxing Xu2010-10-051-10/+10
| | | | | | * Fix dump() to make it consistent with the test case. llvm-svn: 115609
* Added support for base and member destructors in destructor.Marcin Swiderski2010-10-051-0/+62
| | | | llvm-svn: 115592
* Added support for C++ initializers in CFG.Marcin Swiderski2010-10-041-6/+34
| | | | llvm-svn: 115493
* Now the whether adding implicit dtors is controlled by cmd option.Zhongxing Xu2010-10-011-2/+0
| | | | llvm-svn: 115275
* The return value is never used.Zhongxing Xu2010-10-011-7/+8
| | | | llvm-svn: 115272
* Use default augument.Zhongxing Xu2010-10-011-3/+3
| | | | llvm-svn: 115271
* Simplify interface for addLocalScopeForStmt().Zhongxing Xu2010-10-011-9/+9
| | | | llvm-svn: 115270
* The old logic would add non-struct and non C++ struct variables to the localZhongxing Xu2010-10-011-7/+6
| | | | | | | scope. Now we only add C++ struct with non-trivial destructor variables to the local scope. llvm-svn: 115269
* Added generating CFGAutomaticObjDtors for exception variable in catch statement.Marcin Swiderski2010-10-011-0/+12
| | | | llvm-svn: 115266
* Added generating CFGAutomaticObjDtors for init statement, condition variable ↵Marcin Swiderski2010-10-011-3/+26
| | | | | | and implicit scope in for statement. llvm-svn: 115265
* dded generating CFGAutomaticObjDtors for condition variable and implicit ↵Marcin Swiderski2010-10-011-0/+18
| | | | | | scopes in switch statement. llvm-svn: 115264
OpenPOWER on IntegriCloud