[cfe-commits] r157356 - in /cfe/trunk: test/Index/print-typekind.m tools/libclang/CXType.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Wed May 23 16:30:16 PDT 2012
Author: akirtzidis
Date: Wed May 23 18:30:16 2012
New Revision: 157356
URL: http://llvm.org/viewvc/llvm-project?rev=157356&view=rev
Log:
[libclang] Report CXType_ObjCId for 'const id', not CXType_Typedef.
rdar://11357807
Modified:
cfe/trunk/test/Index/print-typekind.m
cfe/trunk/tools/libclang/CXType.cpp
Modified: cfe/trunk/test/Index/print-typekind.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/print-typekind.m?rev=157356&r1=157355&r2=157356&view=diff
==============================================================================
--- cfe/trunk/test/Index/print-typekind.m (original)
+++ cfe/trunk/test/Index/print-typekind.m Wed May 23 18:30:16 2012
@@ -1,10 +1,10 @@
@interface Foo
@property (readonly) id x;
-(int) mymethod;
--(int) mymethod2:(id)x blah:(Class)y boo:(SEL)z;
+-(const id) mymethod2:(id)x blah:(Class)y boo:(SEL)z;
@end
// RUN: c-index-test -test-print-typekind %s | FileCheck %s
// CHECK: ObjCPropertyDecl=x:2:25 typekind=ObjCId [canonical=ObjCObjectPointer]
// 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]
Modified: cfe/trunk/tools/libclang/CXType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CXType.cpp?rev=157356&r1=157355&r2=157356&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CXType.cpp (original)
+++ cfe/trunk/tools/libclang/CXType.cpp Wed May 23 18:30:16 2012
@@ -96,14 +96,15 @@
CXType cxtype::MakeCXType(QualType T, CXTranslationUnit TU) {
CXTypeKind TK = CXType_Invalid;
- if (TU) {
+ if (TU && !T.isNull()) {
ASTContext &Ctx = static_cast<ASTUnit *>(TU->TUData)->getASTContext();
if (Ctx.getLangOpts().ObjC1) {
- if (Ctx.isObjCIdType(T))
+ QualType UnqualT = T.getUnqualifiedType();
+ if (Ctx.isObjCIdType(UnqualT))
TK = CXType_ObjCId;
- else if (Ctx.isObjCClassType(T))
+ else if (Ctx.isObjCClassType(UnqualT))
TK = CXType_ObjCClass;
- else if (Ctx.isObjCSelType(T))
+ else if (Ctx.isObjCSelType(UnqualT))
TK = CXType_ObjCSel;
}
}
More information about the cfe-commits
mailing list