aboutsummaryrefslogtreecommitdiff
path: root/lib/Checker/GRExprEngine.cpp
AgeCommit message (Collapse)Author
2010-12-22[analyzer] Refactoring: lib/Checker -> lib/GR and libclangChecker -> ↵Argyrios Kyrtzidis
libclangGRCore git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122421 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22[analyzer] Refactoring: include/clang/Checker -> include/clang/GRArgyrios Kyrtzidis
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122420 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22If the unary operator is prefix and an lvalue (in C++), bindZhongxing Xu
the location (l-value) to it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122396 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-22After inlining the CXXConstructExpr, bind the temporary object region to it.Zhongxing Xu
This change is necessary when the variable is a const reference and we need the l-value of the construct expr. After that, when binding the variable, recover the lazy compound value when the variable is not a reference. In Environment, use the value of a no-op cast expression when it has one. Otherwise, blast-through it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122388 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20Rename 'VisitLocation' to 'visitLocation'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122271 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-20Rename 'Generate[Node,Sink]' to 'generate[Node,Sink]'.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-19If the initializer is an rvalue and the variable is a const reference,Zhongxing Xu
create a temporary object for it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122161 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-18The evaluation of dereference and address-of is identical.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122146 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17Rename several methods/functions in the analyzerTed Kremenek
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-16Start migration of static analyzer to using theTed Kremenek
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-10It's kindof silly that ExtQuals has an ASTContext&, and we can use thatJohn McCall
space better. Remove this reference. To make that work, change some APIs (most importantly, getDesugaredType()) to take an ASTContext& if they need to return a QualType. Simultaneously, diminish the need to return a QualType by introducing some useful APIs on SplitQualType, which is just a std::pair<const Type *, Qualifiers>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121478 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08Remove the TypesCompatibleExprClass AST node. Merge its functionality into ↵Francois Pichet
BinaryTypeTraitExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07Type traits intrinsic implementation: __is_base_of(T, U)Francois Pichet
New AST node introduced: BinaryTypeTraitExpr; to be reused for more intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121074 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06Rename CXXExprWithTemporaries -> ExprWithCleanups; there's no theoreticalJohn McCall
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-04More anonymous struct/union redesign. This one deals with anonymous field ↵Francois Pichet
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-04Although we currently have explicit lvalue-to-rvalue conversions, they'reJohn McCall
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-03Also include the pointer address of the ExplodedNodeTed Kremenek
when generating DOT output for an ExplodedGraph. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120794 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02Merge ValueManager into SValBuilder.Ted Kremenek
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120696 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02Simplify the ASTs by consolidating ObjCImplicitGetterSetterExpr and ↵John McCall
ObjCPropertyRefExpr into the latter. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120643 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01Rename all 'AssumeXXX' methods in libCheckerTed Kremenek
to 'assumeXXX'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120614 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01Rename all 'EvalXXX' methods in libChecker toTed Kremenek
'evalXXX'. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120609 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01Rename 'SValuator' to 'SValBuilder'. The new nameTed Kremenek
reflects what the class actually does. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120605 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-01Restore the lvalue-to-rvalue conversion patch with a minimal fix.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120555 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30L-value to r-value conversion is not ready for prime-time.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120433 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30Introduce an r-value to l-value cast kind. I'm not promising anythingJohn McCall
about the reliability of this yet. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120422 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-26Regionstore: support derived-to-base cast by creating a CXXBaseObjectRegion.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120173 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-25For CFGAutomaticObjDtor, the type may be reference type, e.g., const A &c = A();Zhongxing Xu
Also apply some new coding style. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120144 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-25handle CXXFunctionalCastExpr in visitLValue and Environment.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120143 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24Let StackFrameContext represent if the call expr is evaluated as lvalue.Zhongxing Xu
This is required for supporting const reference to temporary objects. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120093 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24Use StackFrameContext directly in CallEnter program point. Then we don't needZhongxing Xu
to remake the stackframe everytime in GRExprEngine::ProcessCallEnter(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120087 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24Add an assert() to catch errors using EvalLoad(). Reviewed by kremenek.Zhanyong Wan
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@120073 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20Handle CFGAutomaticObjDtor. Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119897 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18Added method for handling CXXOperatorCallExpr differently from CallExpr if ↵Marcin Swiderski
CXXOperatorCallExpr represents method call. Also fixed returning ExpolodedNodeSet from VisitCXXMethodCallExpr. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119684 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17Add skeleton for handling various cfg dtors.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119491 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16Handle member initializer in C++ ctor. Zhongxing Xu
- Add a new Kind of ProgramPoint: PostInitializer. - Still use GRStmtNodeBuilder. But special handling PostInitializer in GRStmtNodeBuilder::GenerateAutoTransition(). - Someday we should clean up the interface of GRStmtNodeBuilder. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119335 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16Kill CK_Unknown and flesh out the documentation for the existing CastKinds.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119331 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15Add a new expression kind, OpaqueValueExpr, which is useful forJohn McCall
certain internal type-checking procedures as well as for representing certain implicitly-generated operations. Uses to follow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119289 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15Assorted work leading towards the elimination of CK_Unknown.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119138 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-15Add skeleton for handling other kinds of CFGElements.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119135 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-14Add a few more complex-related cast kinds that arise due to arbitraryJohn McCall
implicit conversions; the last batch was specific to promotions. I think this is the full set we need. I do think dividing the cast kinds into floating and integral is probably a good idea. Annotate a *lot* more C casts with useful cast kinds. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119036 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13Introduce five new cast kinds for various conversions into andJohn McCall
between complex types. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118994 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-13Introduce a null-to-pointer implicit cast kind.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118966 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-01Now initializer of C++ record type is visited as block-level expr. Zhongxing Xu
Let the destination of AggExprVisitor be an explicit MemRegion. Reenable the test case. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117908 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20Remove obsolete GRAuditor and GRSimpleAPICheck, which have been completely ↵Ted Kremenek
subsumed by the Checker interface. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116973 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14Eliminate usage of ObjCSuperExpr used forFariborz Jahanian
'super' as receiver of property or a setter/getter methods. //rdar: //8525788 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116483 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14Call PreVisitDeclStmt for C++ aggregate initializers. Patch by Jim Goodnow II.Zhongxing Xu
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116473 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-23Refactor GRExprEngine::VisitCall() to use EvalArguments(), just like ↵Ted Kremenek
VisitCXXMemberCallExpr(). Ideally we should unify these code paths as much as possible, since they only differ by a few details. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114628 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16Refactored BugReporter to refer to EndNode as ErrorNode. We currently make ↵Tom Care
the assumption that EndNode == ErrorNode, but upcoming changes will break this. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114065 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16Introduce new CFGElement hierarchy to support C++ CFG, based on Marcin's patchZhongxing Xu
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-14Rename 'MaxLoop' to 'MaxVisit' in AnalysisManager to more correctly reflect ↵Tom Care
that we aborted analysis may not necessarily be due to a loop. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113862 91177308-0d34-0410-b5e6-96231b3b80d8