Граф коммитов

34 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek 5bd04952d4 [analyzer] teach ExprEngine about loads from static C++ class fields. Fixes <rdar://problem/9948787>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137760 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-16 21:37:52 +00:00
Ted Kremenek 033a07e5fc [analyzer] rename all experimental checker packages to have 'experimental' be the common root package.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136835 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-03 23:14:55 +00:00
Ted Kremenek c46d641094 Teach RegionStore not to symbolic array values whose indices it cannot reason about.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131702 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-19 23:37:58 +00:00
Ted Kremenek 9d5d308c9b static analyzer: invalidate by-ref arguments passed to constructors in a 'new' expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129349 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 05:12:39 +00:00
Ted Kremenek 3bab50b802 Fix bug in SimpleSValBuilder where '--' pointer arithmetic was treated like '++' pointer arithmetic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129348 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 03:49:37 +00:00
Ted Kremenek bf1a66764a RegionStoreManager::invalidateRegions: treat classes the same as structs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129333 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 00:44:31 +00:00
Ted Kremenek 235c02f79e Teach GRState::getSValAsScalarOrLoc() about C++ references.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129329 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12 00:28:12 +00:00
Ted Kremenek 9fec9b1fbd C++ static analysis: also invalidate fields of objects that are the callees in C++ method calls.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129308 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 22:22:05 +00:00
Ted Kremenek 5fe98728dc Start overhauling static analyzer support for C++ constructors. The inlining support isn't complete, and needs
to be reworked to model CallEnter/CallExit (just like all other calls).  For now, treat constructors mostly
like other function calls, making the analysis of C++ code just a little more useful.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129166 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-08 22:42:35 +00:00
Ted Kremenek 94ae8fd470 Static analyzer: fix bug in handling of dynamic_cast<>. The sink node wouldn't always be the final node, thus causing the state to continue propagating. Instead,
recover some path-sensitivity by conjuring a symbol.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128612 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-31 04:46:53 +00:00
Ted Kremenek 41c5f498b2 Teach static analyzer about the basics of handling new[]. We still don't simulate constructors, but at least the analyzer doesn't think the return value is uninitialized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128611 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-31 04:04:48 +00:00
Ted Kremenek b277159055 Begin reworking static analyzer support for C++ method calls. The current logic was divorced
from how we process ordinary function calls, had a tremendous about of redundancy, and relied
strictly on inlining behavior (which was incomplete) to provide semantics instead of falling
back to the conservative analysis we use for C functions.  This is a significant step into
making C++ analyzer support more useful.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128557 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-30 17:41:19 +00:00
Argyrios Kyrtzidis c4d2c9074b [analyzer] Remove '-analyzer-check-objc-mem' flag, the nominee for best misnomer award.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126676 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-28 19:49:42 +00:00
Argyrios Kyrtzidis b3d74da3e1 [analyzer] Migrate NSErrorChecker and DereferenceChecker to CheckerV2.
They cooperate in that NSErrorChecker listens for ImplicitNullDerefEvent events that
DereferenceChecker can dispatch.
ImplicitNullDerefEvent is when we dereferenced a location that may be null.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126659 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-28 17:36:18 +00:00
Argyrios Kyrtzidis 65d39251ff [analyzer] Remove '-analyzer-experimental-internal-checks' flag, it doesn't have any checkers associated with it anymore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126440 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-24 21:43:08 +00:00
Ted Kremenek b8b07b1710 Handle 'UsingDirective' in CFGRecStmtDeclVisitor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125491 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-14 17:00:16 +00:00
Zhongxing Xu 250704bc52 If the unary operator is prefix and an lvalue (in C++), bind
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-22 08:38:13 +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
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
Zhanyong Wan 739830d278 Make Clang static analyzer skip function template definitions. This fixes Clang PR 8426, 8427, & 8433. Reviewed by Ted Kremenek and Doug Gregor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117853 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-31 04:22:34 +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
Ted Kremenek 741b9be084 Teach GRExprEngine::VisitLValue() about FloatingLiteral, ImaginaryLiteral, and CharacterLiteral. Fixes an assertion failure reported in PR 7675.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@109719 91177308-0d34-0410-b5e6-96231b3b80d8
2010-07-29 01:31:59 +00:00
Ted Kremenek 565e465c6d Rename -cc1 option '-checker-cfref' to '-analyzer-check-objc-mem'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95348 91177308-0d34-0410-b5e6-96231b3b80d8
2010-02-05 02:06:54 +00:00
Ted Kremenek de0d263101 Make static analysis support for C++ 'this' expression context-sensitive. Essentially treat 'this' as a implicit parameter to the method call, and associate a region with it.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92675 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 02:18:06 +00:00
Ted Kremenek dd8b441012 Add analyzer test case for 'ForStmt' with condition variable.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92120 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 02:41:19 +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 4c508a12ce Teach GRExprEngine to handle the initialization of the condition variable of a WhileStmt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92106 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 00:54:56 +00:00
Ted Kremenek fcfb503c28 Teach GRExprEngine to handle the initialization of the condition variable of a SwitchStmt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92102 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-24 00:40:03 +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 077a40df25 Also treat the type of the subexpression as a pointer in GRExprEngine::VisitCast when the expression is handled as an lvalue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91969 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 01:19:20 +00:00
Ted Kremenek 949bdb43bf Add basic support for analyzing CastExprs as lvalues.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91952 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-23 00:26:16 +00:00
Zhongxing Xu 910e408098 Use the FunctionDecl's result type to know exactly if it returns a reference.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91751 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-19 03:17:55 +00:00
Ted Kremenek 53287518f6 Enhance GRExprEngine::VisitCallExpr() to be used in an lvalue context. Uncovered a new failing test case along the way, but we're making progress on handling C++ references in the analyzer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91710 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-18 20:13:39 +00:00
Ted Kremenek d87682ed3c Add failing test case for C++ static analysis.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91578 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-17 01:44:13 +00:00