[libclang] Report CXType_ObjCId for 'const id', not CXType_Typedef.
rdar://11357807 llvm-svn: 157356
This commit is contained in:
		
							parent
							
								
									0ce90494e6
								
							
						
					
					
						commit
						03a384ec1f
					
				| 
						 | 
					@ -1,10 +1,10 @@
 | 
				
			||||||
@interface Foo
 | 
					@interface Foo
 | 
				
			||||||
@property (readonly) id x;
 | 
					@property (readonly) id x;
 | 
				
			||||||
-(int) mymethod;
 | 
					-(int) mymethod;
 | 
				
			||||||
-(int) mymethod2:(id)x blah:(Class)y boo:(SEL)z;
 | 
					-(const id) mymethod2:(id)x blah:(Class)y boo:(SEL)z;
 | 
				
			||||||
@end
 | 
					@end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// RUN: c-index-test -test-print-typekind %s | FileCheck %s
 | 
					// RUN: c-index-test -test-print-typekind %s | FileCheck %s
 | 
				
			||||||
// CHECK: ObjCPropertyDecl=x:2:25 typekind=ObjCId [canonical=ObjCObjectPointer]
 | 
					// CHECK: ObjCPropertyDecl=x:2:25 typekind=ObjCId [canonical=ObjCObjectPointer]
 | 
				
			||||||
// CHECK: ObjCInstanceMethodDecl=mymethod:3:8 typekind=Invalid [result=Int]
 | 
					// CHECK: ObjCInstanceMethodDecl=mymethod:3:8 typekind=Invalid [result=Int]
 | 
				
			||||||
// CHECK: ObjCInstanceMethodDecl=mymethod2:blah:boo::4:8 typekind=Invalid [result=Int] [args= ObjCId ObjCClass ObjCSel]
 | 
					// CHECK: ObjCInstanceMethodDecl=mymethod2:blah:boo::4:13 typekind=Invalid [result=ObjCId] [args= ObjCId ObjCClass ObjCSel]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,14 +96,15 @@ static CXTypeKind GetTypeKind(QualType T) {
 | 
				
			||||||
CXType cxtype::MakeCXType(QualType T, CXTranslationUnit TU) {
 | 
					CXType cxtype::MakeCXType(QualType T, CXTranslationUnit TU) {
 | 
				
			||||||
  CXTypeKind TK = CXType_Invalid;
 | 
					  CXTypeKind TK = CXType_Invalid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (TU) {
 | 
					  if (TU && !T.isNull()) {
 | 
				
			||||||
    ASTContext &Ctx = static_cast<ASTUnit *>(TU->TUData)->getASTContext();
 | 
					    ASTContext &Ctx = static_cast<ASTUnit *>(TU->TUData)->getASTContext();
 | 
				
			||||||
    if (Ctx.getLangOpts().ObjC1) {
 | 
					    if (Ctx.getLangOpts().ObjC1) {
 | 
				
			||||||
      if (Ctx.isObjCIdType(T))
 | 
					      QualType UnqualT = T.getUnqualifiedType();
 | 
				
			||||||
 | 
					      if (Ctx.isObjCIdType(UnqualT))
 | 
				
			||||||
        TK = CXType_ObjCId;
 | 
					        TK = CXType_ObjCId;
 | 
				
			||||||
      else if (Ctx.isObjCClassType(T))
 | 
					      else if (Ctx.isObjCClassType(UnqualT))
 | 
				
			||||||
        TK = CXType_ObjCClass;
 | 
					        TK = CXType_ObjCClass;
 | 
				
			||||||
      else if (Ctx.isObjCSelType(T))
 | 
					      else if (Ctx.isObjCSelType(UnqualT))
 | 
				
			||||||
        TK = CXType_ObjCSel;
 | 
					        TK = CXType_ObjCSel;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue