aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/Index/print-typekind.m4
-rw-r--r--tools/libclang/CXType.cpp9
2 files changed, 7 insertions, 6 deletions
diff --git a/test/Index/print-typekind.m b/test/Index/print-typekind.m
index 9eafd24fbe..565c5e38c4 100644
--- a/test/Index/print-typekind.m
+++ b/test/Index/print-typekind.m
@@ -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]
diff --git a/tools/libclang/CXType.cpp b/tools/libclang/CXType.cpp
index fcc13f6139..15f818a244 100644
--- a/tools/libclang/CXType.cpp
+++ b/tools/libclang/CXType.cpp
@@ -96,14 +96,15 @@ static CXTypeKind GetTypeKind(QualType T) {
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;
}
}