aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/ExprEngine.cpp
AgeCommit message (Collapse)Author
2011-08-23[analyzer] Move symbol death leak analysis from CFRefCount to ↵Jordy Rose
RetainReleaseChecker. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138353 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-20[analyzer] Handle reads of ObjCPropertyRefExprs implicitly in Environment. ↵Ted Kremenek
No need to bind an explicit value and create a new node. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138196 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-20Start partitioning ExprEngine.cpp into separate .cpp files that handle ↵Ted Kremenek
different parts of the analysis (e.g., analysis of C expressions, analysis of Objective-C expressions, and so on). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138194 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-16[analyzer] teach ExprEngine about loads from static C++ class fields. Fixes ↵Ted Kremenek
<rdar://problem/9948787>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137760 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-16[analyzer] add ExprEngine::getEagerlyAssumedTags() to allow externally ↵Ted Kremenek
querying of "eagerly assumed" expressions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137704 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-16[analyzer] Remove PostStmtCustom ProgramPoint. It can be represented using ↵Ted Kremenek
tagged PostStmts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137697 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-15Rename GRState to ProgramState, and cleanup some code formatting along the way.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137665 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-12Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer ↵Ted Kremenek
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
2011-08-12[analyzer] change "tag" in ProgramPoint from "void*" to a ProgramPointTag*.Ted Kremenek
Having a notion of an actual ProgramPointTag will aid in introspection of the analyzer's behavior. For example, the GraphViz output of the analyzer will pretty-print the tags in a useful manner. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137529 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-12[analyzer] Introduce new MemRegion, "TypedValueRegion", so that we can ↵Ted Kremenek
separate TypedRegions that implement getValueType() from those that don't. Patch by Olaf Krzikalla! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137498 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-11Cleanup: remove CleanedSate member and GetState() wrapper from ↵Anna Zaks
StmtNodeBuilder, not needed as of r137273. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137284 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10Cleanup: remove GetState() wrapper from ExprEngine, not needed as of r137273.Anna Zaks
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137279 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-10Analyzer Core: In checkDeadSymbols checker callback, provide the state in ↵Anna Zaks
which the symbols are not yet deleted so that checkers could inspect them. Since we are now always creating a transition in ProcessStmt(), remove the logic for adding a transition when none was generated. TODO: the extra transitions will have to be removed; more cleanups; a checker that tests teh new fucntionality. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137273 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-06[analyzer] Simplify logic for ExprEngine::VisitUnaryExprOrTypeTraitExpr to ↵Ted Kremenek
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
2011-08-02[analyzer] Drastically simplify ExprEngine::VisitInitListExpr() by assuming ↵Ted Kremenek
all initializer expressions have already been evaluated. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136706 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-31Remove dead code flagged by GCC's -Wunused-but-set-variable.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136581 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29[analyzer] Remove recursive visitation in ExprEngine::VisitDeclStmt because ↵Ted Kremenek
it isn't needed anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136522 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29[analyzer] Remove recursive visitation in ↵Ted Kremenek
ExprEngine::VisitCompoundLiteralExpr because it isn't needed anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136521 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29[analyzer] Remove recursive visitation in ExprEngine::VisitCastExpr because ↵Ted Kremenek
it isn't needed anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136520 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29[analyzer] Remove recursive visitation in ↵Ted Kremenek
ExprEngine::VisitObjCForCollectionStmt because it isn't needed anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136519 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29[analyzer] Remove explicit argument processing from ↵Ted Kremenek
ExprEngine::VisitObjCMessage() since it is no longer needed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136518 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29[analyzer] Remove recursive visitation in ↵Ted Kremenek
ExprEngine::VisitLValObjCIvarRefExpr because it isn't needed anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136517 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29[analyzer] tighten up ExprEngine::VisitObjCAtSynchronizationStmt().Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136516 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29[analyzer] Remove recursive visitation in ↵Ted Kremenek
ExprEngine::VisitObjCPropertyRefExpr because it isn't needed anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136515 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29[analyzer] Remove recursive visitation in ExprEngine::VisitCallExpr because ↵Ted Kremenek
it isn't needed anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136514 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29[analyzer] Remove recursive visitation in ExprEngine::VisitMemberExpr ↵Ted Kremenek
because it isn't needed anymore. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136513 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29[analyzer] Remove recursive visitation in ↵Ted Kremenek
ExprEngine::VisitLvalArraySubscriptExpr() because it is no longer needed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136512 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-28[analyzer] Overhaul how the static analyzer expects CFGs by forcing CFGs to ↵Ted Kremenek
be linearized only when used by the static analyzer. This required a rewrite of LiveVariables, and exposed a ton of subtle bugs. The motivation of this large change is to drastically simplify the logic in ExprEngine going forward. Some fallout is that the output of some BugReporterVisitors is not as accurate as before; those will need to be fixed over time. There is also some possible performance regression as RemoveDeadBindings will be called frequently; this can also be improved over time. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136419 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-28[analyzer] fix handling of MaterializeTemporaryExpr by binding the result ↵Ted Kremenek
value to the proper expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136412 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25Rename getInstantiationLineNumber to getExpansionLineNumber in bothChandler Carruth
SourceManager and FullSourceLoc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135969 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-25Rename getInstantiationColumnNumber to getExpansionColumnNumber in bothChandler Carruth
SourceManager and FullSourceLoc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135965 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner
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
2011-07-15[analyzer] GNU __null is a pointer-sized integer, not a pointer. Fixes PR10372.Jordy Rose
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135294 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15Create a new expression node, SubstNonTypeTemplateParmExpr,John McCall
to represent a fully-substituted non-type template parameter. This should improve source fidelity, as well as being generically useful for diagnostics and such. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135243 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-07In ARC, reclaim all return values of retainable type, not just thoseJohn McCall
where we have an immediate need of a retained value. As an exception, don't do this when the call is made as the immediate operand of a __bridge retain. This is more in the way of a workaround than an actual guarantee, so it's acceptable to be brittle here. rdar://problem/9504800 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134605 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-21Introduce a new AST node describing reference binding to temporaries.Douglas Gregor
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
2011-06-15Automatic Reference Counting.John McCall
Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133103 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04Add support for builtin astype:Tanya Lattner
__builtin_astype(): Used to reinterpreted as another data type of the same size using for both scalar and vector data types. Added test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132612 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-25static analyzer: when conservatively evaluating functions, don't invalidate ↵Ted Kremenek
the values of globals when the called function is strlen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132100 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-20Fix regression in static analyzer's handling of prefix '--' operator. It ↵Ted Kremenek
was being treated as postfix '--' in C mode. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131770 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-20Introduce Type::isSignedIntegerOrEnumerationType() andDouglas Gregor
Type::isUnsignedIntegerOrEnumerationType(), which are like Type::isSignedIntegerType() and Type::isUnsignedIntegerType() but also consider the underlying type of a C++0x scoped enumeration type. Audited all callers to the existing functions, switching those that need to also handle scoped enumeration types (e.g., those that deal with constant values) over to the new functions. Fixes PR9923 / <rdar://problem/9447851>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131735 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-02Augment retain/release checker to not warn about tracked objects passed as ↵Ted Kremenek
arguments to C++ constructors. This is a stop-gap measure for Objective-C++ code that uses smart pointers to manage reference counts. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130711 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-28Parsing/AST support for Structured Exception HandlingJohn Wiegley
Patch authored by Sohail Somani. Provide parsing and AST support for Windows structured exception handling. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130366 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-28Implementation of Embarcadero array type traitsJohn Wiegley
Patch authored by John Wiegley. These are array type traits used for parsing code that employs certain features of the Embarcadero C++ compiler: __array_rank(T) and __array_extent(T, Dim). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130351 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-25t/clang/expr-traitsJohn Wiegley
Patch authored by David Abrahams. These two expression traits (__is_lvalue_expr, __is_rvalue_expr) are used for parsing code that employs certain features of the Embarcadero C++ compiler. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130122 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-22Add static analyzer support for C++'0X nullptr. Patch by Jim Goodnow II.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130003 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-15C1X: implement generic selectionsPeter Collingbourne
As an extension, generic selection support has been added for all supported languages. The syntax is the same as for C1X. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129554 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14Add support for C++0x's range-based for loops, as specified by the C++11 ↵Richard Smith
draft standard (N3291). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129541 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12After some discussion with Doug, we decided that it made a lot more senseJohn McCall
for __unknown_anytype resolution to destructively modify the AST. So that's what it does now, which significantly simplifies some of the implementation. Normal member calls work pretty cleanly now, and I added support for propagating unknown-ness through &. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129331 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11More __unknown_anytype work.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129269 91177308-0d34-0410-b5e6-96231b3b80d8