Ted Kremenek | 033a07e | 2011-08-03 23:14:55 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s |
Ted Kremenek | e6fbdf5 | 2009-03-12 22:15:08 +0000 | [diff] [blame] | 2 | // |
| 3 | // This test case simply should not crash. It evaluates the logic of not |
| 4 | // using MemRegion::getRValueType in incorrect places. |
| 5 | |
| 6 | typedef signed char BOOL; |
| 7 | typedef unsigned int NSUInteger; |
| 8 | @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; |
| 9 | @protocol NSObject - (BOOL)isEqual:(id)object; |
| 10 | - (Class)class; |
| 11 | - (BOOL)isLegOfClass:(Class)aClass; |
| 12 | @end @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; |
| 13 | @end @interface NSObject <NSObject> { |
| 14 | } |
| 15 | @end @class NSArray; |
| 16 | @interface NSResponder : NSObject <NSCoding> { |
| 17 | } |
| 18 | @end @class NSAttributedString, NSEvent, NSFont, NSFormatter, NSImage, NSMenu, NSText, NSView; |
| 19 | @class JabasectItem; |
| 20 | @protocol EcoClassifier; |
Chris Lattner | 58fe03b | 2009-04-12 08:43:13 +0000 | [diff] [blame] | 21 | @protocol EcoClassInterfaceCommons <EcoClassifier> @end @protocol EcoImplementation; |
Ted Kremenek | e6fbdf5 | 2009-03-12 22:15:08 +0000 | [diff] [blame] | 22 | @protocol EcoBehavioredClassifier <EcoClassInterfaceCommons> - (NSArray *) implementations; |
| 23 | @end enum { |
| 24 | CK_UNRESTRICTED= 0, CK_READ_ONLY, CK_ADD_ONLY, CK_REMOVE_ONLY }; |
| 25 | @protocol EcoClass <EcoBehavioredClassifier> - (NSArray *) ownedAttributes; |
| 26 | @end @protocol EcoNamespace; |
| 27 | @protocol EcoType; |
Chris Lattner | 58fe03b | 2009-04-12 08:43:13 +0000 | [diff] [blame] | 28 | @protocol EcoClassifier <EcoNamespace,EcoType> - (NSArray *) features; |
Ted Kremenek | e6fbdf5 | 2009-03-12 22:15:08 +0000 | [diff] [blame] | 29 | @end @protocol EcoComment; |
| 30 | @protocol EcoElement <NSObject> - (NSArray *) ownedElements; |
| 31 | @end @protocol EcoDirectedRelationship; |
| 32 | @protocol EcoNamedElement <EcoElement> - (NSString *) name; |
| 33 | @end extern NSString *const JabaPathSeparator; |
| 34 | @protocol EcoNamespace <EcoNamedElement> - (NSArray *) Legs; |
| 35 | @end enum { |
| 36 | PDK_IN=0, PDK_INOUT, PDK_OUT, PDK_RETURN }; |
| 37 | @interface EcoElementImp : NSObject <EcoElement, NSCoding> { |
| 38 | } |
| 39 | @end @class EcoNamespace; |
| 40 | @interface EcoNamedElementImp : EcoElementImp <EcoNamedElement>{ |
| 41 | } |
| 42 | @end @interface EcoNamespaceImp : EcoNamedElementImp <EcoNamespace> { |
| 43 | } |
| 44 | @end @class JabaSCDocController, JabaSCDisplaySpecification; |
| 45 | @interface JabaSCSharedDiagramViewController : NSObject { |
| 46 | } |
| 47 | @end extern NSString *const JabaSCsectGraphicNamesectIdentifier; |
| 48 | @interface EcoClassifierImp : EcoNamespaceImp <EcoClassifier> { |
| 49 | } |
| 50 | @end @class EcoOperationImp; |
| 51 | @interface EcoClassImp : EcoClassifierImp <EcoClass> { |
| 52 | } |
| 53 | @end extern NSString *const JabaAddedUMLElements; |
| 54 | @class JabaSCClass, JabaSCInterface, JabaSCOperation; |
| 55 | @class DosLegVaseSymbol, DosProtocolSymbol, DosMethodSymbol, DosFileReference; |
| 56 | @interface HancodeFett : NSObject { |
| 57 | } |
| 58 | + (DosLegVaseSymbol *) symbolFromClass: (JabaSCClass *) clz; |
| 59 | @end enum _JabaSourceLanguage { |
| 60 | JabaSourceUnknown=0, JabaSourcePrawn, JabaSourceC, JabaSourceCPP, JabaSourceObjectiveC }; |
| 61 | typedef NSUInteger JabaSourceLanguage; |
| 62 | @protocol JabaSCClassifier <EcoClassInterfaceCommons> - (JabaSourceLanguage)language; |
| 63 | @end @interface JabaSCClass : EcoClassImp <JabaSCClassifier> { |
| 64 | } |
| 65 | @end @class DosGlobalID, DosPQuLC, DosPQuUnLC; |
| 66 | @protocol XCProxyObjectProtocol - (id) representedObject; |
| 67 | @end typedef union _Dossymbollocation { |
| 68 | } |
| 69 | DosRecordArrPrl; |
| 70 | @interface DosIndexEntry : NSObject { |
| 71 | } |
| 72 | @end @class DosProjectIndex, DosTextPapyruswiggle, DosDocPapyruswiggle, DosLegVaseSymbol; |
| 73 | @interface DosSymbol : DosIndexEntry { |
| 74 | } |
| 75 | @end @interface DosLegVaseSymbol : DosSymbol { |
| 76 | } |
| 77 | @end typedef enum _DosTextRangeType { |
| 78 | Dos_CharacterRangeType = 0, Dos_LineRangeType = 1 } |
| 79 | DosTextRangeType; |
| 80 | @implementation JabaSCSharedDiagramViewController + (NSImage *)findImageNamed:(NSString *)name { |
Mike Stump | b8a087e | 2009-07-21 19:01:01 +0000 | [diff] [blame] | 81 | return 0; |
Ted Kremenek | e6fbdf5 | 2009-03-12 22:15:08 +0000 | [diff] [blame] | 82 | } |
| 83 | - (void)revealSourceInEditor:(JabasectItem *)sectItem duperGesture:(BOOL)duperGesture { |
| 84 | id <EcoNamedElement> selectedElement = [sectItem representedObject]; |
| 85 | id <EcoNamedElement> selectedClassifier = selectedElement; |
| 86 | DosSymbol *symbol=((void *)0); |
| 87 | if([selectedClassifier isLegOfClass:[JabaSCClass class]]) { |
| 88 | symbol = [HancodeFett symbolFromClass:(JabaSCClass *) selectedClassifier]; |
| 89 | } |
| 90 | } |
Fariborz Jahanian | 63e963c | 2009-11-16 18:57:01 +0000 | [diff] [blame] | 91 | @end |