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