aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/ASTContext.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-08-12 06:17:30 +0000
committerDouglas Gregor <dgregor@apple.com>2011-08-12 06:17:30 +0000
commit7a27ea52b7bd635c89bec5a9c521a3bf7d204238 (patch)
treee89f1ae41b586aebd3ce40519a07f055d8b670e4 /lib/AST/ASTContext.cpp
parent79d6726921897811232554ed94c5d77b5b7b3fc0 (diff)
Switch the Objective-C 'SEL' type over to a predefined type in the
AST file format, lazily generating the actual declaration in ASTContext as needed. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@137434 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r--lib/AST/ASTContext.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 5951fcfe0e..8a4c9d3338 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -222,7 +222,7 @@ ASTContext::ASTContext(const LangOptions& LOpts, SourceManager &SM,
DependentTemplateSpecializationTypes(this_()),
SubstTemplateTemplateParmPacks(this_()),
GlobalNestedNameSpecifier(0), IsInt128Installed(false),
- ObjCIdDecl(0), ObjCClassDecl(0),
+ ObjCIdDecl(0), ObjCSelDecl(0), ObjCClassDecl(0),
CFConstantStringTypeDecl(0),
FILEDecl(0),
jmp_bufDecl(0), sigjmp_bufDecl(0), BlockDescriptorType(0),
@@ -430,9 +430,6 @@ void ASTContext::InitBuiltinTypes() {
BuiltinVaListType = QualType();
- // "Builtin" typedefs set by Sema::ActOnTranslationUnitScope().
- ObjCSelTypedefType = QualType();
-
// Builtin types for 'id', 'Class', and 'SEL'.
InitBuiltinType(ObjCBuiltinIdTy, BuiltinType::ObjCId);
InitBuiltinType(ObjCBuiltinClassTy, BuiltinType::ObjCClass);
@@ -4632,8 +4629,16 @@ TypedefDecl *ASTContext::getObjCIdDecl() const {
return ObjCIdDecl;
}
-void ASTContext::setObjCSelType(QualType T) {
- ObjCSelTypedefType = T;
+TypedefDecl *ASTContext::getObjCSelDecl() const {
+ if (!ObjCSelDecl) {
+ QualType SelT = getPointerType(ObjCBuiltinSelTy);
+ TypeSourceInfo *SelInfo = getTrivialTypeSourceInfo(SelT);
+ ObjCSelDecl = TypedefDecl::Create(const_cast<ASTContext &>(*this),
+ getTranslationUnitDecl(),
+ SourceLocation(), SourceLocation(),
+ &Idents.get("SEL"), SelInfo);
+ }
+ return ObjCSelDecl;
}
void ASTContext::setObjCProtoType(QualType QT) {