region-1.m revision 033a07e5fca459ed184369cfee7c90d82367a93a
1// RUN: %clang_cc1 -analyze -analyzer-checker=core,experimental.core -analyzer-store=region -verify %s
2//
3// This test case simply should not crash.  It evaluates the logic of not
4// using MemRegion::getRValueType in incorrect places.
5
6typedef signed char BOOL;
7typedef 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;
21@protocol EcoClassInterfaceCommons <EcoClassifier>    @end  @protocol EcoImplementation;
22@protocol EcoBehavioredClassifier <EcoClassInterfaceCommons>      - (NSArray *) implementations;
23@end enum {
24CK_UNRESTRICTED= 0,     CK_READ_ONLY,     CK_ADD_ONLY,     CK_REMOVE_ONLY };
25@protocol EcoClass <EcoBehavioredClassifier>      - (NSArray *) ownedAttributes;
26@end @protocol EcoNamespace;
27@protocol EcoType;
28@protocol EcoClassifier <EcoNamespace,EcoType>    - (NSArray *) features; 
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 {
36PDK_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 {
60JabaSourceUnknown=0,     JabaSourcePrawn,     JabaSourceC,     JabaSourceCPP,     JabaSourceObjectiveC };
61typedef 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 {
78Dos_CharacterRangeType = 0,     Dos_LineRangeType = 1 }
79  DosTextRangeType;
80@implementation JabaSCSharedDiagramViewController  + (NSImage *)findImageNamed:(NSString *)name {
81  return 0;
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}
91@end
92