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