1// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -analyzer-store=region -verify %s
2// expected-no-diagnostics
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;
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 @end;
29@protocol EcoClassifier <EcoNamespace,EcoType>    - (NSArray *) features;
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  return 0;
83}
84- (void)revealSourceInEditor:(JabasectItem *)sectItem duperGesture:(BOOL)duperGesture {
85  id <EcoNamedElement> selectedElement = [sectItem representedObject];
86  id <EcoNamedElement> selectedClassifier = selectedElement;
87  DosSymbol *symbol=((void *)0);
88  if([selectedClassifier isLegOfClass:[JabaSCClass class]]) {
89    symbol = [HancodeFett symbolFromClass:(JabaSCClass *) selectedClassifier];
90  }
91}
92@end
93