Commit Graph

84 Commits

Author SHA1 Message Date
Dylan Noblesmith e27789991d Basic: import OwningPtr<> into clang namespace
llvm-svn: 149798
2012-02-05 02:12:40 +00:00
Benjamin Kramer 4903802fbf Move a method from IdentifierTable.h out of line and remove the SmallString include.
Fix all the transitive include users.

llvm-svn: 149783
2012-02-04 13:45:25 +00:00
Ted Kremenek 49b1e38e4b Change references to 'const ProgramState *' to typedef 'ProgramStateRef'.
At this point this is largely cosmetic, but it opens the door to replace
ProgramStateRef with a smart pointer that more eagerly acts in the role
of reclaiming unused ProgramState objects.

llvm-svn: 149081
2012-01-26 21:29:00 +00:00
Ted Kremenek 632e3b7ee2 [analyzer] Make the entries in 'Environment' context-sensitive by making entries map from
(Stmt*,LocationContext*) pairs to SVals instead of Stmt* to SVals.

This is needed to support basic IPA via inlining.  Without this, we cannot tell
if a Stmt* binding is part of the current analysis scope (StackFrameContext) or
part of a parent context.

This change introduces an uglification of the use of getSVal(), and thus takes
two steps forward and one step back.  There are also potential performance implications
of enlarging the Environment.  Both can be addressed going forward by refactoring the
APIs and optimizing the internal representation of Environment.  This patch
mainly introduces the functionality upon when we want to build upon (and clean up).

llvm-svn: 147688
2012-01-06 22:09:28 +00:00
Anna Zaks c6aa531a8f [analyzer] Refactor checkers to use helper function for getting callee Decl and name.
We are getting name of the called function or it's declaration in a few checkers. Refactor them to use the helper function in the CheckerContext. 

llvm-svn: 145576
2011-12-01 05:57:37 +00:00
Anna Zaks da4c8d6811 [analyzer] Rename generateNode -> addTransition in CheckerContext
Also document addTransition methods.

llvm-svn: 143059
2011-10-26 21:06:34 +00:00
Anna Zaks b473816b4a [analyzer] Simplify CheckerContext
Remove dead members/parameters: ProgramState, respondsToCallback, autoTransition.
Remove addTransition method since it's the same as generateNode. Maybe we should
rename generateNode to genTransition (since a transition is always automatically
generated)?

llvm-svn: 142946
2011-10-25 19:57:06 +00:00
Jordy Rose 087611ed81 [analyzer] Remove TransferFuncs.h, then deal with the fallout.
And with that, TransferFuncs is gone!

llvm-svn: 139003
2011-09-02 08:02:59 +00:00
Anna Zaks f86615ca5c Static Analyzer Diagnostics: Kill the addVisitorCreator(callbackTy, void*) API in favor of addVisitor(BugReporterVisitor*).
1) Create a header file to expose the predefined visitors. And move the parent(BugReporterVisitor) there as well.

2) Remove the registerXXXVisitor functions - the Visitor constructors/getters can be used now to create the object. One exception is registerVarDeclsLastStore(), which registers more then one visitor, so make it static member of FindLastStoreBRVisitor.

3) Modify all the checkers to use the new API.

llvm-svn: 138126
2011-08-19 22:33:38 +00:00
Anna Zaks 3a6bdf8f82 Remove EnhancedBugReport and RangedBugReport - pull all the extra functionality they provided into their parent BugReport. The only functional changes are: made getRanges() non const - it adds default range to Ranges if none are supplied, made getStmt() private, which was another FIXME.
llvm-svn: 137894
2011-08-17 23:00:25 +00:00
Ted Kremenek 001fd5b498 Rename GRState to ProgramState, and cleanup some code formatting along the way.
llvm-svn: 137665
2011-08-15 22:09:50 +00:00
Ted Kremenek 5ef32dbf2a Cleanup various declarations of 'Stmt*' to be 'Stmt *', etc. in libAnalyzer and libStaticAnalyzer[*]. It was highly inconsistent, and very ugly to look at.
llvm-svn: 137537
2011-08-12 23:37:29 +00:00
Ted Kremenek 8df44b2632 [analyzer] Introduce new MemRegion, "TypedValueRegion", so that we can separate TypedRegions that implement getValueType() from those that don't.
Patch by Olaf Krzikalla!

llvm-svn: 137498
2011-08-12 20:02:48 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Ted Kremenek c85964ed90 [analyzer] Place checking for Core Foundation "Create" rule into a proper API. No functionality change.
llvm-svn: 135349
2011-07-16 19:50:32 +00:00
Anders Carlsson d1f65f61ee Make the VariadicMethodTypeChecker accept block pointers as Objective-C pointers. Fixes PR9746.
llvm-svn: 129741
2011-04-19 01:16:46 +00:00
Ted Kremenek ced5feaec9 Teach VariadicMethodTypeChecker to not crash when processing methods declared in protocols.
llvm-svn: 129395
2011-04-12 21:47:05 +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 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 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
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
Argyrios Kyrtzidis 6a5674ffa6 [analyzer] Rename CheckerV2 -> Checker.
llvm-svn: 126726
2011-03-01 01:16:21 +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 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 507ff53e39 [analyzer] Pass CheckerManager to the registration functions.
llvm-svn: 125777
2011-02-17 21:39:17 +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
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
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
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
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