Ted Kremenek | cdc3a89 | 2012-08-24 20:39:55 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=core,alpha.core -analyzer-store=region -verify %s |
Andy Gibbs | 8e8fb3b | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Ted Kremenek | e6fbdf5 | 2009-03-12 22:15:08 +0000 | [diff] [blame] | 3 | // |
| 4 | // This test case simply should not crash. It evaluates the logic of not |
| 5 | // using MemRegion::getRValueType in incorrect places. |
| 6 | |
| 7 | typedef signed char BOOL; |
| 8 | typedef 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; |
Chris Lattner | 58fe03b | 2009-04-12 08:43:13 +0000 | [diff] [blame] | 22 | @protocol EcoClassInterfaceCommons <EcoClassifier> @end @protocol EcoImplementation; |
Ted Kremenek | e6fbdf5 | 2009-03-12 22:15:08 +0000 | [diff] [blame] | 23 | @protocol EcoBehavioredClassifier <EcoClassInterfaceCommons> - (NSArray *) implementations; |
| 24 | @end enum { |
| 25 | CK_UNRESTRICTED= 0, CK_READ_ONLY, CK_ADD_ONLY, CK_REMOVE_ONLY }; |
| 26 | @protocol EcoClass <EcoBehavioredClassifier> - (NSArray *) ownedAttributes; |
| 27 | @end @protocol EcoNamespace; |
Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 28 | @protocol EcoType @end; |
Chris Lattner | 58fe03b | 2009-04-12 08:43:13 +0000 | [diff] [blame] | 29 | @protocol EcoClassifier <EcoNamespace,EcoType> - (NSArray *) features; |
Ted Kremenek | e6fbdf5 | 2009-03-12 22:15:08 +0000 | [diff] [blame] | 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 { |
| 37 | PDK_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 { |
| 61 | JabaSourceUnknown=0, JabaSourcePrawn, JabaSourceC, JabaSourceCPP, JabaSourceObjectiveC }; |
| 62 | typedef 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 { |
| 79 | Dos_CharacterRangeType = 0, Dos_LineRangeType = 1 } |
| 80 | DosTextRangeType; |
| 81 | @implementation JabaSCSharedDiagramViewController + (NSImage *)findImageNamed:(NSString *)name { |
Mike Stump | b8a087e | 2009-07-21 19:01:01 +0000 | [diff] [blame] | 82 | return 0; |
Ted Kremenek | e6fbdf5 | 2009-03-12 22:15:08 +0000 | [diff] [blame] | 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 | } |
Fariborz Jahanian | 63e963c | 2009-11-16 18:57:01 +0000 | [diff] [blame] | 92 | @end |