Commit Graph

196 Commits

Author SHA1 Message Date
John McCall b4526252db Move some of the logic about classifying Objective-C methods into
conventional categories into Basic and AST.  Update the self-init checker
to use this logic;  CFRefCountChecker is complicated enough that I didn't
want to touch it.

llvm-svn: 126817
2011-03-02 01:50:55 +00:00
Ted Kremenek eff9a7ff91 Teach CFGBuilder to prune trivially unreachable case statements.
llvm-svn: 126797
2011-03-01 23:12:55 +00:00
Ted Kremenek 96a7a59119 In preparation for fixing PR 6884, rework CFGElement to have getAs<> return pointers instead of fresh CFGElements.
- Also, consoldiate getDtorKind() and getKind() into one "kind".
- Add empty getDestructorDecl() method to CFGImplicitDtor.

llvm-svn: 126738
2011-03-01 03:15:10 +00:00
Argyrios Kyrtzidis a9a0f5d206 [analyzer] Also make sure that the parameter is coming from the current stack frame.
llvm-svn: 126735
2011-03-01 01:59:41 +00:00
Argyrios Kyrtzidis 456b18c279 [analyzer] Remove SVal::getAsVarDecl() and reason about MemRegions, not Decls. Suggestion by Ted!
llvm-svn: 126734
2011-03-01 01:47:48 +00:00
Argyrios Kyrtzidis 918c847890 [analyzer] Move lib/StaticAnalyzer/Checkers/ExprEngine.cpp -> lib/StaticAnalyzer/Core
and hope the wrath of the buildbots will not descend upon me.

llvm-svn: 126728
2011-03-01 01:24:23 +00:00
Argyrios Kyrtzidis 6a5674ffa6 [analyzer] Rename CheckerV2 -> Checker.
llvm-svn: 126726
2011-03-01 01:16:21 +00:00
Argyrios Kyrtzidis 0036b19abd [analyzer] Remove Checker V1.
llvm-svn: 126725
2011-03-01 01:16:08 +00:00
Argyrios Kyrtzidis d665807901 [analyzer] Remove checker V1 registration and running from ExprEngine.
llvm-svn: 126724
2011-03-01 01:16:03 +00:00
Zhanyong Wan 5ad574c096 Improves the coding style in SValBuilder. This patch:
- renames evalCastNL and evalCastL to evalCastFromNonLoc and
  evalCastFromLoc (avoid abbreviations that aren't well known).

- makes all function parameter names start with a lower case letter
  for consistency and distinction from member variables.

- avoids abbreviations in function parameter names.

Reviewed by kremenek@apple.com.

llvm-svn: 126722
2011-03-01 00:45:32 +00:00
Argyrios Kyrtzidis 29b8656935 [analyzer] Remove unused checker stuff from AnalysisConsumer and some unused headers.
llvm-svn: 126690
2011-02-28 22:30:38 +00:00
Argyrios Kyrtzidis 9eb02dfa89 [analyzer] Remove '-analyzer-check-objc-mem' flag, the nominee for best misnomer award.
llvm-svn: 126676
2011-02-28 19:49:42 +00:00
Argyrios Kyrtzidis 6a1c760760 [analyzer] Run the ExprEngine depending on the CheckerManager having path-sensitive checkers.
llvm-svn: 126674
2011-02-28 19:49:17 +00:00
Argyrios Kyrtzidis 20f5caa518 [analyzer] The current UninitializedValuesChecker will go away, remove '-warn-uninit-values'.
llvm-svn: 126673
2011-02-28 19:49:12 +00:00
Argyrios Kyrtzidis 2c49ec7f1d [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.

llvm-svn: 126659
2011-02-28 17:36:18 +00:00
Argyrios Kyrtzidis a15dfec3f5 [analyzer] Introduce "event" mechanism in CheckerManager.
A checker can register as receiver/listener of "events" (basically it registers a callback
with a function getting called with an argument of the event type) and other checkers can
register as "dispatchers" and can pass an event object to all the listeners.
This allows cooperation amongst checkers but with very loose coupling.

llvm-svn: 126658
2011-02-28 17:36:09 +00:00
Argyrios Kyrtzidis 98b570ecad [analyzer] Run AST checkers for ObjCMethodDecls.
llvm-svn: 126657
2011-02-28 17:36:04 +00:00
Anders Carlsson 64965ad75d Fix CMake build.
llvm-svn: 126629
2011-02-28 02:13:22 +00:00
Argyrios Kyrtzidis 4b45f6628e [analyzer] Introduce SVal::getAsVarDecl().
llvm-svn: 126627
2011-02-28 01:28:18 +00:00
Argyrios Kyrtzidis 6d6801c5c7 [analzyer] Migrate CallAndMessageChecker to CheckerV2.
llvm-svn: 126626
2011-02-28 01:28:13 +00:00
Argyrios Kyrtzidis 64fe456a6b [analyzer] ExprEngine should not depend on checkers for not crashing.
llvm-svn: 126625
2011-02-28 01:28:08 +00:00
Argyrios Kyrtzidis 0a5a41d799 [analyzer] Migrate AdjustedReturnValueChecker to CheckerV2.
llvm-svn: 126624
2011-02-28 01:28:05 +00:00
Argyrios Kyrtzidis 6fff2e3d36 [analyzer] Migrate AttrNonNullChecker to CheckerV2.
llvm-svn: 126623
2011-02-28 01:28:01 +00:00
Argyrios Kyrtzidis 4f7745a3b1 [analyzer] ExprEngine should not depend on checkers for not crashing.
llvm-svn: 126622
2011-02-28 01:27:57 +00:00
Argyrios Kyrtzidis 68ed625bd3 [analyzer] Migrate VLASizeChecker to CheckerV2.
llvm-svn: 126621
2011-02-28 01:27:54 +00:00
Argyrios Kyrtzidis ae468f77fa [analyzer] Migrate DivZeroChecker to CheckerV2.
llvm-svn: 126620
2011-02-28 01:27:50 +00:00
Argyrios Kyrtzidis 4dc7fb37cb [analyzer] Migrate ReturnUndefChecker to CheckerV2.
llvm-svn: 126619
2011-02-28 01:27:46 +00:00
Argyrios Kyrtzidis da6c7568e2 [analyzer] Migrate UndefinedArraySubscriptChecker to CheckerV2.
llvm-svn: 126618
2011-02-28 01:27:41 +00:00
Argyrios Kyrtzidis 098874a2f8 [analyzer] Migrate UndefinedAssignmentChecker to CheckerV2.
llvm-svn: 126617
2011-02-28 01:27:37 +00:00
Argyrios Kyrtzidis 753b3ca32f [analyzer] Migrate UndefBranchChecker to CheckerV2.
llvm-svn: 126616
2011-02-28 01:27:33 +00:00
Argyrios Kyrtzidis 60b6da721f [analyzer] Migrate UndefCapturedBlockVarChecker to CheckerV2.
llvm-svn: 126615
2011-02-28 01:27:26 +00:00
Argyrios Kyrtzidis d4d3cee6e4 [analyzer] Migrate UndefResultChecker to CheckerV2.
llvm-svn: 126614
2011-02-28 01:27:22 +00:00
Argyrios Kyrtzidis 142dbbfcd8 [analyzer] Migrate NoReturnFunctionChecker to CheckerV2.
llvm-svn: 126613
2011-02-28 01:27:17 +00:00
Argyrios Kyrtzidis 3e7ab19863 [analyzer] Move the DeadStores checker out of the 'core' package.
-Now it gets enabled with '-analyzer-checker=DeadStores'.
-The driver passes the above flag by default.

llvm-svn: 126612
2011-02-28 01:27:12 +00:00
Argyrios Kyrtzidis f3ed8b631d [analyzer] Migrate BuiltinFunctionChecker to CheckerV2.
llvm-svn: 126611
2011-02-28 01:27:07 +00:00
Argyrios Kyrtzidis b2cf708395 [analyzer] Migrate OSAtomicChecker to CheckerV2.
llvm-svn: 126610
2011-02-28 01:27:02 +00:00
Argyrios Kyrtzidis 0a9ce3ec8f [analyzer] Migrate ArrayBoundCheckerV2 to CheckerV2.
Turns -analyzer-check-buffer-overflows into -analyzer-checker=core.experimental.Overflow

llvm-svn: 126609
2011-02-28 01:26:57 +00:00
Argyrios Kyrtzidis 560bbb1241 [analyzer] Turn -analyzer-stats into -analyzer-checker=debug.Stats
llvm-svn: 126608
2011-02-28 01:26:50 +00:00
Argyrios Kyrtzidis 21c9423ef4 [analyzer] Remove '-analyzer-experimental-checks' flag.
llvm-svn: 126607
2011-02-28 01:26:43 +00:00
Argyrios Kyrtzidis 183f0fb4cf [analyzer] Migrate MallocChecker to CheckerV2.
llvm-svn: 126606
2011-02-28 01:26:35 +00:00
Ted Kremenek e925322f41 Update test cases.
llvm-svn: 126523
2011-02-25 22:19:14 +00:00
Ted Kremenek 5eb4b60734 Tidy up help text in Checkers.td, and rename StackAddrLeakChecker to StackAddrEscapeChecker.
llvm-svn: 126522
2011-02-25 22:00:43 +00:00
Argyrios Kyrtzidis 17bee3e70a Intoduce '-analyzer-checker-help' flag which outputs a list of all available static analyzer checkers.
This is pretty basic for now, eventually checkers should be grouped according to package, hidden checkers should be indicated etc.

llvm-svn: 126454
2011-02-25 00:09:51 +00:00
Argyrios Kyrtzidis b388f77ad9 [analyzer] Remove '-analyzer-experimental-internal-checks' flag, it doesn't have any checkers associated with it anymore.
llvm-svn: 126440
2011-02-24 21:43:08 +00:00
Argyrios Kyrtzidis 51695bbb0a [analyzer] Allow a checker to be hidden even if its package is hidden & enabled.
For example, if 'core.experimental.UnreachableCode' is hidden, it should not be enabled with 'core.experimental'.
Note that this requires llvm commit r126436.

llvm-svn: 126439
2011-02-24 21:42:52 +00:00
Argyrios Kyrtzidis 8b08906411 [analyzer] Migrate CastSizeChecker to CheckerV2.
llvm-svn: 126438
2011-02-24 21:42:49 +00:00
Argyrios Kyrtzidis dd407f423b [analyzer] Migrate ArrayBoundChecker to CheckerV2.
llvm-svn: 126371
2011-02-24 08:42:12 +00:00
Argyrios Kyrtzidis 8f38c3843d [analyzer] Don't pass a GRState to CheckerManager::runCheckersForLocation, terrible mistake.
If the state is new, make sure an ExplodedNode is associated with it.

llvm-svn: 126370
2011-02-24 08:42:04 +00:00
Argyrios Kyrtzidis 7bc0141043 [analyzer] Migrate ReturnPointerRangeChecker to CheckerV2.
llvm-svn: 126369
2011-02-24 08:41:57 +00:00
Ted Kremenek d813801384 Fix tiny error in CFG construction for BinaryConditionalOperators, making 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
2011-02-24 03:09:15 +00:00