summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
Commit message (Collapse)AuthorAgeFilesLines
* Enhance RegionStore's reasoning about Objective-C ivars. More testing to ↵Ted Kremenek2009-07-151-16/+40
| | | | | | follow. llvm-svn: 75748
* Use utility method.Zhongxing Xu2009-07-151-1/+1
| | | | llvm-svn: 75745
* Relax assertion.Ted Kremenek2009-07-151-1/+2
| | | | llvm-svn: 75738
* More test cases revealed that the logic in StoreManager::InvalidateRegion() ↵Ted Kremenek2009-07-152-10/+34
| | | | | | | | | | | | | | | | | needs more finesse when handling the invalidation of pointers. Pointers that were invalidated as integers could later cause problems for clients using them as pointers. It is easier for us to model a symbolic value as a pointer rather than modeling a non-symbolic value as a pointer. This patch causes: - StoreManager::InvalidateRegion() to not used the casted type of a region if it would cause a pointer type to be invalidated as a non-pointer type. - Pushes RegionStore::RetrieveElement() further by handling retrievals from symbolic arrays that have been invalidated. This uses the new SymbolDerived construct that was recently introduced. The result is that the failing test in misc-ps-region-store-x86_64.m now passes. Both misc-ps-region-store-x86_64.m and misc-ps-region-store-i386.m contain a test case that motivated this change. llvm-svn: 75730
* Introduced the notion of a "derived symbol" using the class SymbolDerived.Ted Kremenek2009-07-152-0/+44
| | | | | | | | SymbolDerived allows us to model symbolic values that are related to other symbols via a region hierarchy. For example, SymbolDerived can be used to model individual values of a symbolic array. llvm-svn: 75728
* Handle cast of 'ObjCObjectRegion' in StoreManager::InvalidateRegion.Ted Kremenek2009-07-141-1/+5
| | | | llvm-svn: 75713
* Enhance RegionStoreManager to handle 'Retrieve's from SymbolicRegions. We ↵Ted Kremenek2009-07-141-2/+8
| | | | | | do this by silently wrapping the region with an ElementRegion. This fixes the failures in misc-ps-region-store.m. llvm-svn: 75679
* Tweak pretty-printing of CompoundVal to make it more useful for debugging.Ted Kremenek2009-07-141-2/+2
| | | | llvm-svn: 75672
* Introduce Type::isAnyPointerType() and convert all clients (suggested by Chris).Steve Naroff2009-07-141-2/+1
| | | | | | I don't love the name, however it simplifies the code and is a worthwhile change. If/when we come up with a better name, we can do a search/replace. llvm-svn: 75650
* Instead of recovering from a wrong invalidation, this patch aims to Zhongxing Xu2009-07-143-4/+43
| | | | | | | | invalidate the region correctly. It uses the cast-to type to invalidate the region when available. To avoid invalid cast-to type like 'void*' or 'id', region store now only records non-generic casts of regions. llvm-svn: 75580
* Add basic checking for passing NULL to CFRetain/CFRelease, since those functionsTed Kremenek2009-07-142-5/+84
| | | | | | | are not explicitly marked as not accepting NULL pointers. This check illustrates how we need more refactoring in the custom-check logic. llvm-svn: 75570
* Tidy pretty-printing for SVals, using 'dump()' instead of 'printStdErr()', ↵Ted Kremenek2009-07-135-63/+43
| | | | | | and implementing operator<< support for llvm::raw_ostream. llvm-svn: 75560
* When pretty-printing symbolic regions, use '{' ... '}' to indicate the ↵Ted Kremenek2009-07-131-1/+1
| | | | | | symbol used for the region (makes it easier to read for nested regions). llvm-svn: 75550
* Change pretty-printing API for SymExprs and MemRegions to use a naming ↵Ted Kremenek2009-07-133-49/+33
| | | | | | convention and style similar to other elements in Clang. llvm-svn: 75548
* Enhance SimpleSValuator::EvalBinOpNN to recognize the trivial caseTed Kremenek2009-07-131-1/+20
| | | | | | | | | | | | where we are comparing a symbolic value against itself, regardless of the nature of that symbolic value. This enhancement identified a case where RegionStoreManager is not correctly symbolicating the values of the pointees of parameters. The failing test is now in 'test/Analysis/misc-ps-region-store.m', with that test file now (temporarily) marked XFAIL. llvm-svn: 75521
* Handle insidious corner case exposed by RegionStoreManager when handling ↵Ted Kremenek2009-07-111-0/+13
| | | | | | | | void* values that are bound to symbolic regions and then treated like integers. llvm-svn: 75356
* Restructure RegionStoreManager::EvalBinOp() as a switch dispatch over differentTed Kremenek2009-07-111-33/+59
| | | | | | | MemRegion kinds. This allows the compiler to identify what MemRegions we don't handle for pointer arithmetic. llvm-svn: 75326
* This patch includes a conceptually simple, but very intrusive/pervasive change. Steve Naroff2009-07-104-83/+66
| | | | | | | | | | | | The idea is to segregate Objective-C "object" pointers from general C pointers (utilizing the recently added ObjCObjectPointerType). The fun starts in Sema::GetTypeForDeclarator(), where "SomeInterface *" is now represented by a single AST node (rather than a PointerType whose Pointee is an ObjCInterfaceType). Since a significant amount of code assumed ObjC object pointers where based on C pointers/structs, this patch is very tedious. It should also explain why it is hard to accomplish this in smaller, self-contained patches. This patch does most of the "heavy lifting" related to moving from PointerType->ObjCObjectPointerType. It doesn't include all potential "cleanups". The good news is additional cleanups can be done later (some are noted in the code). This patch is so large that I didn't want to include any changes that are purely aesthetic. By making the ObjC types truly built-in, they are much easier to work with (and require fewer "hacks"). For example, there is no need for ASTContext::isObjCIdStructType() or ASTContext::isObjCClassStructType()! We believe this change (and the follow-up cleanups) will pay dividends over time. Given the amount of code change, I do expect some fallout from this change (though it does pass all of the clang tests). If you notice any problems, please let us know asap! Thanks. llvm-svn: 75314
* Restructure RegionStoreManager::getSizeInElements() to use a switch statementTed Kremenek2009-07-101-52/+67
| | | | | | | over the types of MemRegions. This allows the compiler to warn us which regions are not handled, and also is a little faster. llvm-svn: 75304
* Revert r75281 and simply remove the assertion in NewCastRegion thatTed Kremenek2009-07-101-25/+3
| | | | | | | | CodeTextRegions can only be casted to FunctionPointer or BlockPointerTypes. This simply isn't true. We can handle bogus operations on CodeTextRegions (e.g, an array access) elsewhere. llvm-svn: 75285
* Fix crash in StoreManager::NewCastRegion regarding handling casts to void*,Ted Kremenek2009-07-101-3/+24
| | | | | | void**, void***, etc. Such casts should just pass the region through. llvm-svn: 75281
* Rename potentially ambiguous member template 'getRegion' to 'getSubRegion' ↵Ted Kremenek2009-07-101-4/+4
| | | | | | to hopefully resolve template lookup ambiguities on some compilers. llvm-svn: 75253
* Switch BasicStoreManager to use the new CastRegion implementation by default,Ted Kremenek2009-07-101-3/+3
| | | | | | | | and replace the 'clang-cc' option '-analyzer-store=basic-new-cast' with '-analyzer-store=basic-old-cast'. We'll keep the old CastRegion implementation around for a little while for regression testing. llvm-svn: 75209
* Remove dead code.Zhongxing Xu2009-07-091-1/+0
| | | | llvm-svn: 75127
* fix comment.Zhongxing Xu2009-07-071-2/+2
| | | | llvm-svn: 74890
* NewCastRegion: Handle casts *from* pointers to incomplete structs to other ↵Ted Kremenek2009-07-061-9/+19
| | | | | | types. llvm-svn: 74884
* Fix 80 col violation.Ted Kremenek2009-07-061-4/+4
| | | | llvm-svn: 74877
* Restructure NewCastRegion to use a switch statement that dispatches off theTed Kremenek2009-07-061-51/+62
| | | | | | | region type. This better shows the logic of the method and allows the compiler to check if we didn't handle a specific region kind. llvm-svn: 74876
* Fix 80 col violation.Ted Kremenek2009-07-061-2/+2
| | | | llvm-svn: 74875
* NewCastRegion: Handle casts to any Objective-C pointer, not just qualified ids.Ted Kremenek2009-07-061-2/+2
| | | | llvm-svn: 74874
* Implement FIXME.Ted Kremenek2009-07-061-1/+1
| | | | llvm-svn: 74872
* StoreManager::NewCastRegion:Ted Kremenek2009-07-061-10/+22
| | | | | | | | - Refactor logic that creates ElementRegions into a help method 'MakeElementRegion'. - Fix crash due to not handling StringRegions. Casts of StringRegions now result in a new ElementRegion layered on the original StringRegion. llvm-svn: 74867
* Make 'BasicStoreManager' + 'NewCastRegion' testable from the command line ↵Ted Kremenek2009-07-061-2/+6
| | | | | | using '-analyzer-store=basic-new-cast'. llvm-svn: 74865
* NewCastRegion:Ted Kremenek2009-07-061-12/+10
| | | | | | | - Have test for 'CodeTextRegion' dominate other region tests. - Use 'getAsRecordType' instead of isa<RecordType> llvm-svn: 74853
* Fix loop so that 'continue' statements actually cause the loop to iterate.Ted Kremenek2009-07-061-2/+1
| | | | llvm-svn: 74852
* Move the new 'CastRegion' implementation from RegionStoreManager to StoreManagerTed Kremenek2009-07-062-83/+83
| | | | | | | (its superclass). This will allow us to experiment with using the new CastRegion with BasicStoreManager, and gradually phase out the old implementation. llvm-svn: 74851
* Fix <rdar://problem/7033733>. The CF_RETURNS_RETAINED attribute should work ↵Ted Kremenek2009-07-061-3/+11
| | | | | | if the return type on an Objective-C method is a CF type reference, not just an Objective-C object reference. llvm-svn: 74841
* Further cleanup of region invalidation code. No functionality change.Zhongxing Xu2009-07-062-54/+57
| | | | llvm-svn: 74816
* Start to gradually move region invalidation code into store manager.Zhongxing Xu2009-07-062-66/+60
| | | | | | No functionality change. llvm-svn: 74812
* remove utility methods that are not very useful.Zhongxing Xu2009-07-031-1/+1
| | | | llvm-svn: 74762
* Remove unused method.Ted Kremenek2009-07-031-3/+0
| | | | llvm-svn: 74751
* BasicStoreManager: Use SymbolManager::canSymbolicate() to determine if a ↵Ted Kremenek2009-07-031-1/+1
| | | | | | variable can be symbolicated. llvm-svn: 74750
* Replace guarded calls in RegionStoreManager toTed Kremenek2009-07-021-21/+7
| | | | | | | | | ValueManager::getRegionValueSymbolVal() with unguarded calls to ValueManager::getRegionValueSymbolValOrUnknown(). This changes centralizes the decision of what values to symbolicate in SymbolManager rather than having it scatter in RegionStoreManager. llvm-svn: 74730
* Enhance RegionStore to lazily symbolicate fields and array elements forTed Kremenek2009-07-022-2/+13
| | | | | | structures passed-by-value as function arguments. llvm-svn: 74729
* StoreManagers: Use 'hasGlobalsStorage()' and 'hasParametersStorage()' instead ofTed Kremenek2009-07-023-7/+21
| | | | | | | directly consulting if a VarDecl is an implicit or actual parameter, a global, etc. llvm-svn: 74716
* Add a separate MemSpaceRegion for function/method arguments passed on the stack.Ted Kremenek2009-07-021-3/+11
| | | | | | | This will simplify the logic of StoreManagers that want to specially reason about the values of parameters. llvm-svn: 74715
* Remove commented methods. Add MemRegion::printStdErr().Ted Kremenek2009-07-021-0/+4
| | | | llvm-svn: 74709
* Minor code cleanup: pull variables into scope of 'if' statement, limiting theirTed Kremenek2009-07-011-10/+8
| | | | | | actual lifetime to their logical lifetime. llvm-svn: 74665
* Add a FIXME to RegionStore, do some minor code cleanup, and get RegionStore toTed Kremenek2009-07-011-11/+23
| | | | | | | | pass misc-ps.m. Currently RegionStore/BasicStore don't do any special reasoning about clang-style vectors, so we should return UnknownVal (in all cases) when accessing their values via an array. llvm-svn: 74660
* add fixme.Zhongxing Xu2009-07-012-0/+3
| | | | llvm-svn: 74581
OpenPOWER on IntegriCloud