Lenny Maiorani
6ffe738f24
Add security syntax checker for strcpy() which causes the Static Analyzer to generate a warning any time the strcpy() function is used with a note suggesting to use a function which provides bounded buffers.
...
llvm-svn: 128679
2011-03-31 22:09:14 +00:00
Lenny Maiorani
79d74141b1
Adding Static Analyzer checker for mempcpy().
...
Models mempcpy() so that if length is NULL the destination pointer is returned. Otherwise, the source and destination are confirmed not to be NULL and not overlapping. Finally the copy is validated to not cause a buffer overrun and the return value is bound to the address of the byte after the last byte copied.
llvm-svn: 128677
2011-03-31 21:36:53 +00:00
Lenny Maiorani
70568c2be7
Fix spelling in a comment. (test commit)
...
llvm-svn: 128670
2011-03-31 21:26:55 +00:00
Ted Kremenek
40d16c0e75
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.
llvm-svn: 128612
2011-03-31 04:46:53 +00:00
Ted Kremenek
61a4f6682a
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.
...
llvm-svn: 128611
2011-03-31 04:04:48 +00:00
Ted Kremenek
98a24e37c5
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.
llvm-svn: 128557
2011-03-30 17:41:19 +00:00
Argyrios Kyrtzidis
84d7907797
[analyzer] Allow all checkers of a group to be enabled.
...
llvm-svn: 128512
2011-03-29 23:57:41 +00:00
Argyrios Kyrtzidis
437758cbe6
[analyzer] For -analyzer-checker-help show all the info about groups, packages, and which packages/checkers are hidden.
...
llvm-svn: 128511
2011-03-29 23:57:38 +00:00
Argyrios Kyrtzidis
4ee039647a
[analyzer] Checker Packages can now belong to a group. This requires llvm commit r128474.
...
llvm-svn: 128475
2011-03-29 18:54:02 +00:00
Anders Carlsson
642b03413f
Don't add a symbolic region for 'this' if the member function is static.
...
llvm-svn: 128340
2011-03-26 14:30:44 +00:00
Ted Kremenek
104f6dfd1f
Tweak grammar in checker description.
...
llvm-svn: 128310
2011-03-26 00:25:42 +00:00
Ted Kremenek
49c79790de
Rework checker "packages" and groups to be more hierarchical.
...
llvm-svn: 128187
2011-03-24 00:28:47 +00:00
Ted Kremenek
ddc06d0bd0
Rename class 'CFGReachabilityAnalysis' to 'CFGReverseBlockReachabilityAnalysis'.
...
This rename serves two purposes:
- It reflects the actual functionality of this analysis.
- We will have more than one reachability analysis.
llvm-svn: 127930
2011-03-19 01:00:33 +00:00
Ted Kremenek
70727343cf
Teach VariadicMethodTypeChecker about pointers attributed as 'NSObject'.
...
llvm-svn: 127798
2011-03-17 04:10:25 +00:00
Ted Kremenek
6fa1daede5
Teach VariadicMethodTypeChecker that CF references are valid arguments to variadic Objective-C methods.
...
llvm-svn: 127797
2011-03-17 04:01:35 +00:00
Ted Kremenek
3e5ad5932e
Tweak RegionStore's handling of lazy compound values to use the 'Default' versus 'Direct' binding key, thus allowing specific elements of an array/struct to be overwritten without
...
invalidating the entire binding. Fixes PR 9455.
llvm-svn: 127796
2011-03-17 03:51:51 +00:00
Ted Kremenek
4ceebbf54d
VariadicMethodTypeChecker: don't warn for null pointer constants passed to variadic Objective-C methods.
...
llvm-svn: 127719
2011-03-16 00:22:51 +00:00
Ted Kremenek
cdb2ae587a
Remove bogus assertion in IdempotentOperationsChecker.
...
llvm-svn: 127687
2011-03-15 19:27:57 +00:00
Joerg Sonnenberger
161f9a3829
Sort
...
llvm-svn: 127624
2011-03-14 21:20:46 +00:00
Ted Kremenek
066b226daa
Tweak VariadicMethodTypeChecker to only create one ExplodedNode when issuing multiple warnings for the same message expression.
...
Also add a test case showing that we correctly report multiple warnings for the same message expression.
llvm-svn: 127605
2011-03-14 19:50:37 +00:00
Anders Carlsson
d91d5f162f
Add an Objective-C checker that checks that arguments passed to some variadic Objective-C methods are of Objective-C pointer types.
...
Ted or Argiris, I'd appreciate a review!
llvm-svn: 127572
2011-03-13 20:35:21 +00:00
Ted Kremenek
a4a57c10da
Re-enable the IdempotentOperations checker for --analyze, and put it and the DeadStores checker into the "deadcode" group.
...
llvm-svn: 127531
2011-03-12 06:14:28 +00:00
Ted Kremenek
e5a89ac52a
Don't have side-effects (or rather non-trivial computation) in StringSwitch "cases."
...
llvm-svn: 127528
2011-03-12 04:08:07 +00:00
Ted Kremenek
f89710b936
Add initial version of "IteratorsChecker", a checker to find misues uses of C++ iterators.
...
This checker was created by Jim Goodnow II, and I migrated it to the
new Checker interface (recent changes by Argiris).
llvm-svn: 127525
2011-03-12 02:49:15 +00:00
Ted Kremenek
52d264cda5
Fix comments, and force auto progagation in VisitAggExpr.
...
llvm-svn: 127524
2011-03-12 02:49:11 +00:00
Ted Kremenek
97474f7414
static analyzer: Handle 'ExprWithCleanups' in ExprEngine by essentially ignoring them.
...
llvm-svn: 127523
2011-03-12 02:49:09 +00:00
Peter Collingbourne
e190dee7a5
Add support for the OpenCL vec_step operator, by generalising and
...
extending the existing support for sizeof and alignof. Original
patch by Guy Benyei.
llvm-svn: 127475
2011-03-11 19:24:49 +00:00
Ted Kremenek
2f1f023283
#include Store.h into BasicValueFactory.cpp to provide definitions of StoreRef constructor.
...
llvm-svn: 127291
2011-03-08 23:39:37 +00:00
Ted Kremenek
4bb6c6b37e
static analyzer: Fix use-after-free bug in RegionStore involving LazyCompoundValueData not reference counting Store objects.
...
llvm-svn: 127288
2011-03-08 23:18:00 +00:00
Anders Carlsson
3c50aea73f
Make the Objective-C checker look for subclasses of NSString instead of just NSString and NSMutableString.
...
llvm-svn: 127268
2011-03-08 20:05:26 +00:00
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
Argyrios Kyrtzidis
4769e9376e
[analyzer] Remove unused functions from CheckerManager.
...
llvm-svn: 126352
2011-02-24 01:05:37 +00:00
Argyrios Kyrtzidis
785459a2a9
[analyzer] Migrate StreamChecker to CheckerV2.
...
llvm-svn: 126351
2011-02-24 01:05:33 +00:00
Argyrios Kyrtzidis
c26f15dbad
[analyzer] Migrate CStringChecker to CheckerV2.
...
llvm-svn: 126350
2011-02-24 01:05:30 +00:00
Argyrios Kyrtzidis
506220fef7
[analyzer] Migrate StackAddrLeakChecker to CheckerV2.
...
llvm-svn: 126333
2011-02-23 21:04:54 +00:00
Argyrios Kyrtzidis
f1b5d1f01b
[analyzer] Refactor EndOfFunctionNodeBuilder.
...
-Introduce EndOfFunctionNodeBuilder::withCheckerTag to allow it be "specialized" with a
checker tag and not require the checkers to pass a tag.
-For EndOfFunctionNodeBuilder::generateNode, reverse the order of tag/P parameters since
there are actual calls that assume the second parameter is ExplodedNode.
llvm-svn: 126332
2011-02-23 21:04:49 +00:00
Argyrios Kyrtzidis
66b38c2261
[analyzer] Migrate IdempotentOperationChecker to CheckerV2.
...
llvm-svn: 126331
2011-02-23 21:04:44 +00:00
Argyrios Kyrtzidis
68cab73ab9
[analyzer] const goodness.
...
llvm-svn: 126326
2011-02-23 19:38:45 +00:00
Argyrios Kyrtzidis
d0732a660a
[analyzer] Rename runPathSensitiveCheckers -> expandGraphWithCheckers.
...
llvm-svn: 126325
2011-02-23 19:38:41 +00:00
Argyrios Kyrtzidis
da02a25ae6
[analyzer] Migrate ChrootChecker to CheckerV2.
...
llvm-svn: 126324
2011-02-23 19:38:39 +00:00
Argyrios Kyrtzidis
bf61d97a98
[analyzer] Migrate UnreachableCodeChecker to CheckerV2.
...
llvm-svn: 126308
2011-02-23 07:19:23 +00:00
Argyrios Kyrtzidis
aad8372516
[analyzer] Migrate to CheckerV2:
...
NSAutoreleasePoolChecker
ObjCAtSyncChecker
llvm-svn: 126307
2011-02-23 07:19:18 +00:00
Argyrios Kyrtzidis
99ea46462a
[analyzer] Add LangOptions in CheckerManager.
...
llvm-svn: 126306
2011-02-23 07:19:14 +00:00
Ted Kremenek
80861ca9b5
Migrate CFGReachabilityAnalysis out of the IdempotentOperationsChecker and into its own analysis file.
...
llvm-svn: 126289
2011-02-23 01:51:59 +00:00
Ted Kremenek
cc7f1f8c2e
Have IdempotentOperationsChecker pull its CFGStmtMap from AnalysisContext.
...
llvm-svn: 126288
2011-02-23 01:51:53 +00:00
Argyrios Kyrtzidis
dff865d10b
[analyzer] Migrate to CheckerV2:
...
CastToStructChecker
FixedAddressChecker
MacOSXAPIChecker
PointerArithChecker
PointerSubChecker
PthreadLockChecker
UnixAPIChecker
llvm-svn: 126284
2011-02-23 01:05:36 +00:00
Argyrios Kyrtzidis
dd058d8a50
[analyzer] Migrate the BasicObjCFoundationChecks to CheckerV2:
...
NilArgChecker
CFNumberCreateChecker
ClassReleaseChecker
llvm-svn: 126275
2011-02-23 00:16:10 +00:00
Argyrios Kyrtzidis
22f2586bfb
[analyzer] Fix CheckerManager::runCheckersForObjCMessage.
...
It would run PostObjCMessage checkers even for PreObjCMessage checking.
llvm-svn: 126274
2011-02-23 00:16:07 +00:00
Argyrios Kyrtzidis
a1540db6e4
[analyzer] Refactor BugTypes and their ownership model.
...
-In general, don't have the BugReporter deleting BugTypes, BugTypes will eventually become owned by checkers
and outlive the BugReporter. In the meantime, there will be some leaks since some checkers assume that
the BugTypes they create will be destroyed by the BugReporter.
-Have BugReporter::EmitBasicReport create BugTypes that are reused if the same name & category strings
are passed to EmitBasicReport. These BugTypes are owned and destroyed by the BugReporter.
This allows bugs reported through EmitBasicReport to be coalesced.
-Remove the llvm::FoldingSet<BugReportEquivClass> from BugType and move it into the BugReporter.
For uniquing BugReportEquivClass also use the BugType* so that we can iterate over all of them using only one set.
llvm-svn: 126272
2011-02-23 00:16:01 +00:00
Argyrios Kyrtzidis
ed35cf271d
[analyzer] Start moving the path-sensitive checkers to CheckerV2.
...
-Migrate ObjCSelfInitChecker to CheckerV2. In the process remove the 'preCallSelfFlags' field
from the checker class and use GRState for storing that info.
-Get ExprEngine to start delegating checker running to CheckerManager.
llvm-svn: 126229
2011-02-22 17:30:38 +00:00
Ted Kremenek
fb1a79af7a
Add CStringChecker support for strncpy. Patch by Lenny Maiorani!
...
llvm-svn: 126188
2011-02-22 04:58:34 +00:00
Ted Kremenek
280a01fa1b
Add CStringChecker support for strnlen. Patch by Lenny Maiorani!
...
llvm-svn: 126187
2011-02-22 04:55:05 +00:00
Oscar Fuentes
6f72540e46
New function for tablegenning: clang_tablegen.
...
llvm-svn: 126093
2011-02-20 22:06:32 +00:00
Oscar Fuentes
e9c7994669
Correct name of dependent target.
...
CMake complained about this while generating VS project files but was
okay with it while generating makefiles on Linux.
llvm-svn: 126090
2011-02-20 19:41:34 +00:00
Oscar Fuentes
f7fa56f25f
Fix some add_dependencies.
...
The syntax is (add_dependencies target-name depend-target1 ...).
llvm-svn: 126049
2011-02-19 21:38:48 +00:00
Argyrios Kyrtzidis
eb8357c1d8
[analyzer] Fix crash when analyzing C++ code.
...
llvm-svn: 126025
2011-02-19 08:03:18 +00:00
Ted Kremenek
ff6fd0f4b0
Change 'StoreRef' back to 'Store' in GRState, shrinking the size of GRState back by one pointer.
...
llvm-svn: 126020
2011-02-19 03:56:19 +00:00
Argyrios Kyrtzidis
21f347e729
[analyzer] Fix crash when analyzing C++ code.
...
llvm-svn: 126013
2011-02-19 01:59:41 +00:00
Ted Kremenek
fda3687515
Add 'StoreRef' smart pointer to allow more fine-grain memory lifetime control of Store objects.
...
This yields a minor memory reduction (for larger functions) on Sqlite at the cost of slightly
higher memory usage on some functions because of the increased size of GRState (which can be optimized).
I expect the real memory savings from this enhancement will come when we aggressively
canabilize more of the ExplodedGraph.
llvm-svn: 126012
2011-02-19 01:59:33 +00:00
Argyrios Kyrtzidis
e34245b30b
[analyzer] Fix crash when analyzing C++ code.
...
llvm-svn: 126007
2011-02-19 01:08:41 +00:00
Argyrios Kyrtzidis
ec016464ca
[analyzer] Fix crash when analyzing C++ code.
...
llvm-svn: 125963
2011-02-18 21:24:56 +00:00
Oscar Fuentes
79b52bfc46
CMake: updated source file list.
...
llvm-svn: 125783
2011-02-17 22:07:39 +00:00
Argyrios Kyrtzidis
57d736fd46
[analyzer] Use the new registration mechanism for the debugging info "checks".
...
The relative checker package is 'debug':
'-dump-live-variables' is replaced by '-analyzer-checker=debug.DumpLiveVars'
'-cfg-view' is replaced by '-analyzer-checker=debug.ViewCFG'
'-cfg-dump' is replaced by '-analyzer-checker=debug.DumpCFG'
llvm-svn: 125780
2011-02-17 21:39:39 +00:00
Argyrios Kyrtzidis
af45aca670
[analyzer] Use the new registration mechanism on the non-path-sensitive-checkers:
...
DeadStoresChecker
ObjCMethSigsChecker
ObjCUnusedIvarsChecker
SizeofPointerChecker
ObjCDeallocChecker
SecuritySyntaxChecker
llvm-svn: 125779
2011-02-17 21:39:33 +00:00
Argyrios Kyrtzidis
24ffc08f39
[analyzer]
...
-Introduce CheckerV2, a set of templates for convenient declaration & registration of checkers.
Currently useful just for checkers working on the AST not the path-sensitive ones.
-Enhance CheckerManager to actually collect the checkers and turn it into the entry point for
running the checkers.
-Use the new mechanism for the LLVMConventionsChecker.
llvm-svn: 125778
2011-02-17 21:39:24 +00:00
Argyrios Kyrtzidis
507ff53e39
[analyzer] Pass CheckerManager to the registration functions.
...
llvm-svn: 125777
2011-02-17 21:39:17 +00:00
Argyrios Kyrtzidis
9d5235d527
When building StaticAnalyzer/Frontend add -I "<Checkers build dir>" to allow Checkers.inc to be
...
included without '..', thus being compatible with build systems of *BSDs.
Patch by Joerg Sonnenberger!
llvm-svn: 125758
2011-02-17 18:40:33 +00:00
John McCall
c07a0c7e48
Change the representation of GNU ?: expressions to use a different expression
...
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
2011-02-17 10:25:35 +00:00
Chris Lattner
c8e630e4db
Step #1/N of implementing support for __label__: split labels into
...
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
2011-02-17 07:39:24 +00:00
Chris Lattner
5a9b1ec94c
simplify a bit.
...
llvm-svn: 125724
2011-02-17 05:38:27 +00:00
Zhanyong Wan
85a203ebdd
Makes most methods in SVals.h conform to the naming guide. Reviewed
...
by kremenek.
llvm-svn: 125687
2011-02-16 21:13:32 +00:00
Nick Lewycky
bb1e5079b2
Revert r125642. This broke the build? It should be a no-op.
...
llvm-svn: 125645
2011-02-16 02:34:28 +00:00
Nick Lewycky
757515588a
Don't use "../foo" to return to the current directory.
...
llvm-svn: 125642
2011-02-16 02:10:49 +00:00
Argyrios Kyrtzidis
034d68e97d
[analyzer] AnalyzerFrontend is dependent on AnalyzerCheckers.
...
llvm-svn: 125637
2011-02-16 01:40:55 +00:00
Argyrios Kyrtzidis
9d4d4f9104
[analyzer] Use the new registration mechanism on the apple checkers:
...
NilArgChecker
CFNumberCreateChecker
NSAutoreleasePoolChecker
CFRetainReleaseChecker
ClassReleaseChecker
llvm-svn: 125636
2011-02-16 01:40:52 +00:00
Argyrios Kyrtzidis
a9215281de
[analyzer] Use the new registration mechanism on some of the experimental internal checkers:
...
CastToStructChecker
FixedAddressChecker
PointerArithChecker
PointerSubChecker
llvm-svn: 125612
2011-02-15 22:55:20 +00:00
Argyrios Kyrtzidis
b2400924d9
[analyzer] Use the new registration mechanism on the IdempotentOperationChecker.
...
llvm-svn: 125611
2011-02-15 22:55:14 +00:00
Argyrios Kyrtzidis
f81ff04ba3
[analyzer] Remove ObjCSelfInitCheck from AnalyzerOptions.
...
llvm-svn: 125599
2011-02-15 21:25:07 +00:00
Argyrios Kyrtzidis
2d3905ffac
[analyzer] Use the new registration mechanism on some of the experimental checks. These are:
...
CStringChecker
ChrootChecker
MallocChecker
PthreadLockChecker
StreamChecker
UnreachableCodeChecker
MallocChecker creates implicit dependencies between checkers and needs to be handled differently.
llvm-svn: 125598
2011-02-15 21:25:03 +00:00
Douglas Gregor
9892e3545a
Add missing CMake dependency
...
llvm-svn: 125566
2011-02-15 17:09:56 +00:00
Argyrios Kyrtzidis
6fa0d20a6f
Fix the clang-wpa example.
...
llvm-svn: 125565
2011-02-15 16:54:12 +00:00
Argyrios Kyrtzidis
4e52527c28
[analyzer] Reflect changes for tablegen'ing the checkers.
...
-Update tablegen files for checkers, use the tablegen class name for the checker class name.
-Update ClangSACheckersProvider to not look into hidden checker packages.
llvm-svn: 125560
2011-02-15 07:42:38 +00:00
Argyrios Kyrtzidis
a6d04d541d
[analyzer] Use the new registration mechanism on some of the internal checks. These are:
...
StackAddrLeakChecker
ObjCAtSyncChecker
UnixAPIChecker
MacOSXAPIChecker
The rest have/create implicit dependencies between checkers and need to be handled differently.
llvm-svn: 125559
2011-02-15 07:42:33 +00:00
Ted Kremenek
4ea9004fe8
IdempotentOperationChecker: don't repeatedly recompute block reachability.
...
llvm-svn: 125548
2011-02-15 02:20:03 +00:00
Oscar Fuentes
c9987fbbfe
Add current binary and source directories to the header search list
...
for all compiler invocations.
llvm-svn: 125514
2011-02-14 20:14:11 +00:00
Argyrios Kyrtzidis
f0619868ae
Remove left-over #include.
...
llvm-svn: 125507
2011-02-14 19:02:35 +00:00
Argyrios Kyrtzidis
556c45e9c5
[analyzer] Overhauling of the checker registration mechanism.
...
-Checkers will be defined in the tablegen file 'Checkers.td'.
-Apart from checkers, we can define checker "packages" that will contain a collection of checkers.
-Checkers can be enabled with -analyzer-checker=<name> and disabled with -analyzer-disable-checker=<name> e.g:
Enable checkers from 'cocoa' and 'corefoundation' packages except the self-initialization checker:
-analyzer-checker=cocoa -analyzer-checker=corefoundation -analyzer-disable-checker=cocoa.SelfInit
-Introduces CheckerManager and CheckerProvider. CheckerProviders get the set of checker names to enable/disable and
register them with the CheckerManager which will be the entry point for all checker-related functionality.
Currently only the self-initialization checker takes advantage of the new mechanism.
llvm-svn: 125503
2011-02-14 18:13:31 +00:00
Argyrios Kyrtzidis
4ec3cf9937
[analyzer] Remove ManagerRegistry which is not used. In the future we may load analyzer plugins dynamically but
...
registration through static constructors should be avoided.
llvm-svn: 125502
2011-02-14 18:13:17 +00:00
Argyrios Kyrtzidis
2ef5f3c1c5
[analyzer] Move include/clang/StaticAnalyzer/AnalysisConsumer.h -> lib/StaticAnalyzer/Frontend/AnalysisConsumer.h since
...
FrontendActions.cpp is the only user.
llvm-svn: 125501
2011-02-14 18:13:11 +00:00
Argyrios Kyrtzidis
ae92c95d34
[analyzer] Move Checkers/FrontendActions.cpp -> Frontend/FrontendActions.cpp
...
llvm-svn: 125500
2011-02-14 18:13:06 +00:00
Argyrios Kyrtzidis
ecd3334dac
[analyzer] Introduce libclangStaticAnalyzerFrontend and move Checkers/AnalysisConsumer.cpp into Frontend lib.
...
llvm-svn: 125499
2011-02-14 18:13:01 +00:00
Ted Kremenek
3374e03344
Remove dead code in IdempotentOperationChecker.
...
llvm-svn: 125497
2011-02-14 18:05:07 +00:00
Ted Kremenek
5794ef6950
Fix edge case where we don't cull warnings in IdempotentOperationsChecker due to incomplete analysis of loops.
...
llvm-svn: 125495
2011-02-14 17:59:23 +00:00
Ted Kremenek
a71d5d31a1
Use 'BitVector' instead of SmallPtrSet<CFGBlock*> in IdempotentOperationsChecker. No real functionality change.
...
llvm-svn: 125494
2011-02-14 17:59:20 +00:00
Ted Kremenek
c059798756
Teach the IdempotentOperations checker to ignore property setters.
...
llvm-svn: 125443
2011-02-12 18:50:03 +00:00
Ted Kremenek
70aeefa17e
Weaken the ObjCSelfInitChecker to only warn when one calls an 'init' method within an 'init' method. This is a temporary stop gap to avoid false positives while we investigate how to make it smarter.
...
llvm-svn: 125427
2011-02-12 03:03:54 +00:00
Ted Kremenek
10b5926e29
static analyzer: Also invalidate instance variables of a receiver in a message expression, just as we do with parameters.
...
Fixes <rdar://problem/8725041>.
llvm-svn: 125422
2011-02-12 01:01:31 +00:00
Ted Kremenek
b1c392aa56
Don't emit a dead store for '++' operations unless it occurs with a return statement. We've never seen any other cases that were real bugs.
...
Fixes <rdar://problem/6962292>.
llvm-svn: 125419
2011-02-12 00:17:19 +00:00
Jeffrey Yasskin
c498878e6d
Add CMake dependencies so that LLVM_USED_LIBS order doesn't matter.
...
I also sorted the tools/driver dependencies since their order no
longer matters.
llvm-svn: 125417
2011-02-11 23:46:38 +00:00
Ted Kremenek
9865d7f0e6
Don't report dead stores on unreachable code paths. Fixes <rdar://problem/8405222>.
...
llvm-svn: 125415
2011-02-11 23:24:26 +00:00
Ted Kremenek
7b3f290d61
Remove RegionStoreManager::evalBinOp(), which is now handled by the SValBuilder.
...
llvm-svn: 125396
2011-02-11 19:48:19 +00:00
Ted Kremenek
eddeba0dae
Rename 'InvalidateRegions()' to 'invalidateRegions()'.
...
llvm-svn: 125395
2011-02-11 19:48:15 +00:00
Ted Kremenek
5662dfefad
Allow the 'Eng' entry in GRStateManager to be a (possibly null) pointer instead of a reference.
...
llvm-svn: 125362
2011-02-11 04:20:16 +00:00
NAKAMURA Takumi
98dd73d66c
CMake: LLVM_NO_RTTI must be obsolete now!
...
llvm-svn: 125275
2011-02-10 09:15:32 +00:00
Ted Kremenek
1656db69f3
Run ~GRState() when reclaiming GRStates.
...
llvm-svn: 125262
2011-02-10 03:07:40 +00:00
Ted Kremenek
75e4564140
static analyzer: Make GRStates reference counted, with reference counts managed by ExplodedNodes.
...
This reduces memory usage of the analyzer on sqlite by another 5%.
llvm-svn: 125260
2011-02-10 02:21:52 +00:00
Ted Kremenek
f8cbac4b91
Split 'include/clang/StaticAnalyzer' into 'include/clang/StaticAnalyzer/Core' and 'include/clang/StaticAnalyzer/Checkers'.
...
This layout matches lib/StaticAnalyzer, which corresponds to two StaticAnalyzer libraries.
llvm-svn: 125251
2011-02-10 01:03:03 +00:00
Peter Collingbourne
41f8546233
AST, Sema, Serialization: add CUDAKernelCallExpr and related semantic actions
...
llvm-svn: 125217
2011-02-09 21:07:24 +00:00
John McCall
bd06678921
Remove vtables from the Stmt hierarchy; this was pretty easy as
...
there were only three virtual methods of any significance.
The primary way to grab child iterators now is with
Stmt::child_range children();
Stmt::const_child_range children() const;
where a child_range is just a std::pair of iterators suitable for
being llvm::tie'd to some locals. I've left the old child_begin()
and child_end() accessors in place, but it's probably a substantial
penalty to grab the iterators individually now, since the
switch-based dispatch is kindof inherently slower than vtable
dispatch. Grabbing them together is probably a slight win over the
status quo, although of course we could've achieved that with vtables, too.
I also reclassified SwitchCase (correctly) as an abstract Stmt
class, which (as the first such class that wasn't an Expr subclass)
required some fiddling in a few places.
There are somewhat gross metaprogramming hooks in place to ensure
that new statements/expressions continue to implement
getSourceRange() and children(). I had to work around a recent clang
bug; dgregor actually fixed it already, but I didn't want to
introduce a selfhosting dependency on ToT.
llvm-svn: 125183
2011-02-09 08:16:59 +00:00
Ted Kremenek
a40f8ebc83
static analyzer: Further reduce the analyzer's memory usage when analyzing sqlite3 by 7-10% by recylcing "uninteresting" ExplodedNodes.
...
The optimization involves eagerly pruning ExplodedNodes from the ExplodedGraph that contain
practically no difference between the predecessor and successor nodes. For example, if
the state is different between a predecessor and a node, the node is left in. Only for
the 'environment' component of the state do we not care if the ExplodedNodes are different.
This paves the way for future optimizations where we can reclaim the environment objects.
llvm-svn: 125154
2011-02-09 01:27:33 +00:00
Ted Kremenek
1953f97ac9
analyzer, retain/release checker: Remove hack where objects passed in message to 'self' are no longer tracked.
...
llvm-svn: 125130
2011-02-08 22:54:26 +00:00
Argyrios Kyrtzidis
fa0734ec4f
[analyzer] Move the files in lib/StaticAnalyzer to lib/StaticAnalyzer/Core.
...
Eventually there will also be a lib/StaticAnalyzer/Frontend that will handle initialization and checker registration.
Yet another library to avoid cyclic dependencies between Core and Checkers.
llvm-svn: 125124
2011-02-08 22:30:36 +00:00
Argyrios Kyrtzidis
4975170267
[analyzer] lib/StaticAnalyzer/Checkers/ExprEngineExperimentalChecks.cpp -> lib/StaticAnalyzer/Checkers/ExperimentalChecks.cpp
...
llvm-svn: 125123
2011-02-08 22:30:15 +00:00
Argyrios Kyrtzidis
f410a6299f
[analyzer] lib/StaticAnalyzer/Checkers/ExprEngineExperimentalChecks.h -> lib/StaticAnalyzer/Checkers/ExperimentalChecks.h
...
llvm-svn: 125122
2011-02-08 22:30:11 +00:00
Argyrios Kyrtzidis
f99d595cfd
[analyzer] lib/StaticAnalyzer/Checkers/ExprEngineInternalChecks.h -> lib/StaticAnalyzer/Checkers/InternalChecks.h
...
llvm-svn: 125121
2011-02-08 22:30:02 +00:00
Argyrios Kyrtzidis
dd03d8ddaa
[analyzer] Fix a false positive of the 'self' initialization checker.
...
A common pattern in classes with multiple initializers is to put the
subclass's common initialization bits into a static function that receives
the value of 'self', e.g:
if (!(self = [super init]))
return nil;
if (!(self = _commonInit(self)))
return nil;
It was reported that 'self' was not set to the result of [super init].
Until we can use inter-procedural analysis, in such a call, transfer the
ObjCSelfInitChecker flags associated with 'self' to the result of the call.
Fixes rdar://8937441 & http://llvm.org/PR9094
llvm-svn: 124940
2011-02-05 05:54:53 +00:00
Argyrios Kyrtzidis
58f8b590e1
[analyzer] Fix a crash until we can handle temporary struct objects properly.
...
llvm-svn: 124822
2011-02-03 22:01:32 +00:00
John McCall
c63de66c4f
An insomniac stab at making block declarations list the variables they close
...
on, as well as more reliably limiting invalid references to locals from
nested scopes.
llvm-svn: 124721
2011-02-02 13:00:07 +00:00
Argyrios Kyrtzidis
c1b4534e42
Fix the message. Thanks to Thomas Clement for noticing.
...
llvm-svn: 124680
2011-02-01 20:33:05 +00:00
Argyrios Kyrtzidis
15a3daa189
[analyzer] Slightly improve the diagnostic message of ObjCSelfInitChecker.
...
llvm-svn: 124674
2011-02-01 19:32:55 +00:00
Ted Kremenek
afe348ea43
Wire up attributes 'ns_consumed' and 'cf_consumed' in the static analyzer's ObjC retain/release checker.
...
llvm-svn: 124386
2011-01-27 18:43:03 +00:00
Argyrios Kyrtzidis
add754a02e
[analyzer] Fix crash when handling dot syntax on 'super'.
...
llvm-svn: 124376
2011-01-27 16:17:11 +00:00
NAKAMURA Takumi
f9cbcc4cc2
Fix whitespace.
...
llvm-svn: 124364
2011-01-27 07:10:08 +00:00
NAKAMURA Takumi
7c2888689d
7bit-ize.
...
llvm-svn: 124363
2011-01-27 07:09:49 +00:00
Ted Kremenek
0e89838ced
Hook up attribute ns_consumes_self in the ObjC retain/release checker in the static analyzer.
...
llvm-svn: 124360
2011-01-27 06:54:14 +00:00
Argyrios Kyrtzidis
c7ffd35cb7
[analyzer] Enable the self-init checker under command-line option '-analyzer-check-objc-self-init' which by default
...
is enabled by the driver for '--analyze'.
llvm-svn: 124266
2011-01-26 01:26:50 +00:00
Argyrios Kyrtzidis
8781b7dded
[analyzer] Improve the diagnostic for the self-init checker. Suggestion by Ted!
...
llvm-svn: 124263
2011-01-26 01:26:41 +00:00
Argyrios Kyrtzidis
3ae681eb12
[analyzer] Do the self-init check only on NSObject subclasses. Patch by Jean-Daniel Dupas!
...
llvm-svn: 124249
2011-01-25 23:54:44 +00:00
Ted Kremenek
fedad3c668
Don't try and symbolicate unions; we don't reason
...
about them yet. Fixes crash reported in PR 9049.
llvm-svn: 124228
2011-01-25 21:08:47 +00:00
Ted Kremenek
ade45d9703
Recycle memory for GRStates that are never referenced
...
by ExplodedNodes. This leads to about a 4-8%
reduction in memory footprint when analyzing
functions in sqlite3.
llvm-svn: 124214
2011-01-25 19:13:54 +00:00
Ted Kremenek
7fd987de23
Tweak wording of static analyzer diagnostic
...
for a block capturing the value of an uninitialized
variable.
llvm-svn: 124212
2011-01-25 19:13:42 +00:00
Argyrios Kyrtzidis
ffb08c46fa
[analyzer] Handle the dot syntax for properties in the ExprEngine.
...
We translate property accesses to obj-c messages by simulating "loads" or "stores" to properties
using a pseudo-location SVal kind (ObjCPropRef).
Checkers can now reason about obj-c messages for both explicit message expressions and implicit
messages due to property accesses.
llvm-svn: 124161
2011-01-25 00:04:03 +00:00
Argyrios Kyrtzidis
fdbcd54658
[analyzer] Introduce ExprEngine::VisitObjCMessage for handling general ObjCMessages (both message expressions and property access)
...
and use it in ExprEngine::VisitObjCMessageExpr.
llvm-svn: 124160
2011-01-25 00:03:57 +00:00
Argyrios Kyrtzidis
37ab726d63
[analyzer] Introduce ObjCMessage which represents both explicit ObjC message expressions and implicit
...
messages that are sent for handling properties in dot syntax.
Replace all direct uses of ObjCMessageExpr in the checkers and checker interface with ObjCMessage.
llvm-svn: 124159
2011-01-25 00:03:53 +00:00
Argyrios Kyrtzidis
8e169a5f18
[analyzer] Simplify GetReceiverType function in BasicObjCFoundationChecks.cpp; no functionality change.
...
llvm-svn: 124157
2011-01-25 00:03:45 +00:00
Ken Dyck
c28614cec4
Use CharUnits for the offset amount of RegionRawOffset.
...
llvm-svn: 124093
2011-01-24 01:55:39 +00:00
Ted Kremenek
a1ec4f39f4
Enhance AnalysisConsumer to also visit functions
...
and methods defined within 'namespace X { ... }'.
llvm-svn: 123921
2011-01-20 17:09:48 +00:00
John McCall
424cec97bd
Change QualType::getTypePtr() to return a const pointer, then change a
...
thousand other things which were (generally inadvertantly) relying on that.
llvm-svn: 123814
2011-01-19 06:33:43 +00:00
Jeffrey Yasskin
8dfa5f1776
Fix warnings found by gcc-4.6, from -Wunused-but-set-variable and
...
-Wint-to-pointer-cast.
llvm-svn: 123719
2011-01-18 02:00:16 +00:00
Douglas Gregor
45e84b0053
NetBSD, OpenBSD, and Dragonfly BSD also have arc4random. Patch from
...
Joerg Sonnenberger!
llvm-svn: 123669
2011-01-17 19:16:24 +00:00
Douglas Gregor
cdbc539aee
Introduce a new expression kind, SubstNonTypeTemplateParmPackExpr,
...
that captures the substitution of a non-type template argument pack
for a non-type template parameter pack within a pack expansion that
cannot be fully expanded. This follows the approach taken by
SubstTemplateTypeParmPackType.
llvm-svn: 123506
2011-01-15 01:15:58 +00:00
Ted Kremenek
8cb349de80
Cleanup confused code that redundantly called "getDeclContext()" twice.
...
Found by clang static analyzer.
llvm-svn: 123485
2011-01-14 22:31:41 +00:00
Ted Kremenek
44e2c5cdd9
Rename 'RemoveDeadBindings()' to 'removeDeadBindings()'
...
llvm-svn: 123460
2011-01-14 20:34:15 +00:00
Ted Kremenek
7c211625e0
Rename 'EnterStackFrame()' to 'enterStackFrame()'.
...
llvm-svn: 123459
2011-01-14 20:34:10 +00:00
Ted Kremenek
95d874fa5d
Teach RegionStore::EnterStackFrame() to handle
...
the case where the called function has fewer
formal arguments than actual arguments. This
fixes a crash in the analyzer when doing
function call inlining.
Patch by Zhenbo Xu!
llvm-svn: 123458
2011-01-14 20:29:43 +00:00
Ted Kremenek
c7ed09378e
Rename 'CheckDeadStores.cpp' to 'DeadStoresChecker.cpp'.
...
llvm-svn: 123395
2011-01-13 20:58:59 +00:00
Ted Kremenek
f224820b45
Remove warning in dead stores checker for
...
dead stores within nested assignments. I have
never seen an actual bug found by this specific
warning, and it can lead to many false positives.
llvm-svn: 123394
2011-01-13 20:58:56 +00:00
Zhongxing Xu
3a3c0fd2d1
CXXBaseObjectRegion is like FieldRegion. Need to blast through it when
...
getting the base region. This makes the RemoveDeadBindings() correct.
llvm-svn: 123375
2011-01-13 12:46:31 +00:00
Zhongxing Xu
0d87e0c65b
Support inlining base initializers. We still haven't got it completely right,
...
since the bindings are purged after they are set up. Need to investigate
RemoveDeadBindings algorithm.
llvm-svn: 123374
2011-01-13 12:30:12 +00:00
Ted Kremenek
304b6e4aa1
Fix a corner case in RegionStore where we assign
...
a struct value to a symbolic index into array.
RegionStore can't actually reason about this,
so we were getting bogus warnings about loading
uninitialized values from the array. The solution
is invalidate the entire array when we cannot
represent the binding explicitly.
Fixes <rdar://problem/8848957>
llvm-svn: 123368
2011-01-13 06:58:15 +00:00
Ted Kremenek
f41bdd7c24
Rename 'HasGeneratedNode' to 'hasGeneratedNode'
...
and 'getBasePredecessor()' to 'getPredecessor()'.
Also remove a unneeded save-and-restore of
node builder's tag field.
llvm-svn: 123363
2011-01-13 04:36:46 +00:00
Ted Kremenek
b86ec25256
Remove unnecessary save-and-restore of the
...
node builder's 'HasGeneratedNode' field.
llvm-svn: 123362
2011-01-13 04:36:40 +00:00
Ted Kremenek
f044bd68e1
Remove CheckerContext's dependence on setting
...
the node builder's "tag" ivar (which we would
like to remove).
llvm-svn: 123361
2011-01-13 04:36:36 +00:00
Zhongxing Xu
ebbeb79234
Add some documentation for C++ static analyzer.
...
llvm-svn: 123313
2011-01-12 07:20:03 +00:00
Argyrios Kyrtzidis
4b7433fab2
[analyzer] Introduce ObjCSelfInitChecker, which checks initialization methods to verify that they assign 'self' to the
...
result of an initialization call (e.g. [super init], or [self initWith..]) before using any instance variable or
returning 'self'.
llvm-svn: 123264
2011-01-11 19:45:25 +00:00
Argyrios Kyrtzidis
9c23e6c689
[analyzer] Support post-visiting ObjCIvarRefExprs for checkers.
...
llvm-svn: 123263
2011-01-11 19:45:20 +00:00
Argyrios Kyrtzidis
1790c975e7
[analyzer] Add 'isLoad' parameter in Checker::visitLocation() to conveniently distinguish between loads/stores.
...
llvm-svn: 123261
2011-01-11 19:45:13 +00:00
Ted Kremenek
841df11dab
Remove ProgramPoint parameter from GenericNodeBuilder::generateNode().
...
llvm-svn: 123240
2011-01-11 16:53:44 +00:00
Francois Pichet
9b76fa9b07
Rename GenericNodeBuilder to GenericNodeBuilderRefCount to avoid namespace clash using MSVC.
...
llvm-svn: 123228
2011-01-11 10:41:37 +00:00
Ted Kremenek
a00bccc0c5
Rework ExprEngine::processCFGBlockEntrance()
...
to use a node builder. This paves the way
for Checkers to interpose (via a "visit" method)
at the entrance to blocks.
llvm-svn: 123217
2011-01-11 06:37:47 +00:00
Ted Kremenek
f82068a994
Remove several silly methods from ento::CoreEngine
...
that just forwarded to ento::SubEngine.
llvm-svn: 123216
2011-01-11 04:49:40 +00:00
Ted Kremenek
f4ef3d3ca1
Rename misc. methods in ento::Worklist to start
...
with lowercase letter.
llvm-svn: 123212
2011-01-11 02:34:50 +00:00
Ted Kremenek
926c96211e
Rename misc. methods in GRSubEngine to start
...
with a lower-case letter. No functionality change.
llvm-svn: 123211
2011-01-11 02:34:45 +00:00
Michael J. Spencer
e503f89b4b
Replace all uses of PathV1::isDirectory with PathV2::fs::is_directory.
...
llvm-svn: 123208
2011-01-11 01:21:20 +00:00
Zhongxing Xu
fb060c9014
Fix CMakeLists.txt.
...
llvm-svn: 123167
2011-01-10 09:33:41 +00:00
Zhongxing Xu
40c9d8a4c5
Revert r123160. There are linking dependency problems.
...
llvm-svn: 123166
2011-01-10 09:23:01 +00:00
Douglas Gregor
eff85ad41b
Unbreak the CMake build.
...
llvm-svn: 123162
2011-01-10 07:26:53 +00:00
Zhongxing Xu
7d4ab7d915
ExprEngine.cpp and AnalysisConsumer.cpp should not be in the Checkers directory.
...
llvm-svn: 123160
2011-01-10 05:52:42 +00:00
Zhongxing Xu
5609e21337
In C++, assignment and compound assignment operators return an lvalue.
...
llvm-svn: 123158
2011-01-10 03:54:19 +00:00
Zhongxing Xu
0710f5c5e1
The isPrefix() checking is redundant. Lvalue incremental/decremental expressions
...
are all prefixes.
llvm-svn: 123156
2011-01-10 03:22:57 +00:00
Alexis Hunt
1d7926502f
Renamed CXXBaseOrMemberInitializer to CXXCtorInitializer. This is both shorter,
...
more accurate, and makes it make sense for it to hold a delegating constructor
call.
llvm-svn: 123084
2011-01-08 20:30:50 +00:00
Douglas Gregor
35c7e84eb7
There is nothing interesting to analyze with a sizeof...(pack) expression
...
llvm-svn: 122818
2011-01-04 18:46:34 +00:00
Douglas Gregor
e8e9dd624c
Implement support for pack expansions whose pattern is a non-type
...
template argument (described by an expression, of course). For
example:
template<int...> struct int_tuple { };
template<int ...Values>
struct square {
typedef int_tuple<(Values*Values)...> type;
};
It also lays the foundation for pack expansions in an initializer-list.
llvm-svn: 122751
2011-01-03 17:17:50 +00:00
Oscar Fuentes
2835efdc75
Set LLVM_NO_RTTI and LLVM_USED_LIBS for clangStaticAnalyzerCheckers
...
Patch by arrowdodger!
llvm-svn: 122747
2011-01-03 14:53:25 +00:00
Ted Kremenek
5614c46fcf
Add basic support for pointer arithmetic in
...
SimpleSValBuilder. This clears up some
false positives emitted by ArrayBoundCheckerV2
due to the lack of support for pointer arithmetic.
llvm-svn: 122546
2010-12-24 08:39:33 +00:00
Argyrios Kyrtzidis
9d6af5328e
Remove the EntoSA directories.
...
llvm-svn: 122543
2010-12-24 06:19:58 +00:00
Ted Kremenek
d99bd55a5e
Chris Lattner has strong opinions about directory
...
layout. :)
Rename the 'EntoSA' directories to 'StaticAnalyzer'.
Internally we will still use the 'ento' namespace
for the analyzer engine (unless there are further
sabre rattlings...).
llvm-svn: 122514
2010-12-23 19:38:26 +00:00