diff options
author | Steve Naroff <snaroff@apple.com> | 2009-07-15 18:40:39 +0000 |
---|---|---|
committer | Steve Naroff <snaroff@apple.com> | 2009-07-15 18:40:39 +0000 |
commit | de2e22d33afec98324a66a358dfe0951b3c7259a (patch) | |
tree | d4bb699e42464c745d95b1d753e62a916d3415ed /lib/Sema/Sema.cpp | |
parent | 92db2841691b2f2a99294872ead8887854297ed7 (diff) |
Implement the ObjC pseudo built-in types as clang "BuiltinType's". I say pseudo built-in types, since Sema still injects a typedef for recognition (i.e. they aren't truly built-ins from a parser perspective).
This removes the static data/methods on ObjCObjectPointerType while preserving the nice API (no need to fiddle with ASTContext:-).
This patch also adds Type::isObjCBuiltinType().
This should be the last fairly large patch related to recrafting the ObjC type system. The follow-on patches should be fairly small.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@75808 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r-- | lib/Sema/Sema.cpp | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 9b58e47746..39662511f1 100644 --- a/lib/Sema/Sema.cpp +++ b/lib/Sema/Sema.cpp @@ -149,35 +149,23 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) { Context.setObjCProtoType(Context.getObjCInterfaceType(ProtocolDecl)); PushOnScopeChains(ProtocolDecl, TUScope); } - // Create the built-in decls/typedefs for 'id' and 'Class'. + // Create the built-in typedef for 'id'. if (Context.getObjCIdType().isNull()) { - ObjCInterfaceDecl *IdIDecl = - ObjCInterfaceDecl::Create(Context, CurContext, SourceLocation(), - &Context.Idents.get("id"), - SourceLocation(), true); - QualType IdIType = Context.getObjCInterfaceType(IdIDecl); - QualType ObjCIdType = Context.getObjCObjectPointerType(IdIType); - - TypedefDecl *IdTypedef = TypedefDecl::Create(Context, CurContext, - SourceLocation(), - &Context.Idents.get("id"), - ObjCIdType); + TypedefDecl *IdTypedef = + TypedefDecl::Create( + Context, CurContext, SourceLocation(), &Context.Idents.get("id"), + Context.getObjCObjectPointerType(Context.ObjCBuiltinIdTy) + ); PushOnScopeChains(IdTypedef, TUScope); Context.setObjCIdType(Context.getTypeDeclType(IdTypedef)); } - // Create the built-in decls/typedefs and type for "Class". + // Create the built-in typedef for 'Class'. if (Context.getObjCClassType().isNull()) { - ObjCInterfaceDecl *ClassIDecl = - ObjCInterfaceDecl::Create(Context, CurContext, SourceLocation(), - &Context.Idents.get("Class"), - SourceLocation(), true); - QualType ClassIType = Context.getObjCInterfaceType(ClassIDecl); - QualType ObjCClassType = Context.getObjCObjectPointerType(ClassIType); - - TypedefDecl *ClassTypedef = TypedefDecl::Create(Context, CurContext, - SourceLocation(), - &Context.Idents.get("Class"), - ObjCClassType); + TypedefDecl *ClassTypedef = + TypedefDecl::Create( + Context, CurContext, SourceLocation(), &Context.Idents.get("Class"), + Context.getObjCObjectPointerType(Context.ObjCBuiltinClassTy) + ); PushOnScopeChains(ClassTypedef, TUScope); Context.setObjCClassType(Context.getTypeDeclType(ClassTypedef)); } |