]> granicus.if.org Git - clang/commitdiff
minor tweaks
authorChris Lattner <sabre@nondot.org>
Tue, 30 Oct 2007 20:57:56 +0000 (20:57 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 30 Oct 2007 20:57:56 +0000 (20:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43515 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/Sema.cpp
Sema/SemaDecl.cpp

index 5bd5df5539e9628516e74ad4fbc4b180f6b2c801..2be198de43be7b9d4f8880dbe222c129e1b159c9 100644 (file)
@@ -31,17 +31,18 @@ void Sema::ActOnTranslationUnitScope(SourceLocation Loc, Scope *S) {
 /// For now, we will *not* install id as a built-in. FIXME: reconsider this.
 QualType Sema::GetObjcIdType(SourceLocation Loc) {
   assert(TUScope && "GetObjcIdType(): Top-level scope is null");
-  if (Context.getObjcIdType().isNull()) {
-    IdentifierInfo *IdIdent = &Context.Idents.get("id");
-    ScopedDecl *IdDecl = LookupScopedDecl(IdIdent, Decl::IDNS_Ordinary, 
-                                          SourceLocation(), TUScope);
-    TypedefDecl *ObjcIdTypedef = dyn_cast_or_null<TypedefDecl>(IdDecl);
-    if (!ObjcIdTypedef) {
-      Diag(Loc, diag::err_missing_id_definition);
-      return QualType();
-    }
-    Context.setObjcIdType(ObjcIdTypedef);
+  if (!Context.getObjcIdType().isNull())
+    return Context.getObjcIdType();
+    
+  IdentifierInfo *IdIdent = &Context.Idents.get("id");
+  ScopedDecl *IdDecl = LookupScopedDecl(IdIdent, Decl::IDNS_Ordinary, 
+                                        SourceLocation(), TUScope);
+  TypedefDecl *ObjcIdTypedef = dyn_cast_or_null<TypedefDecl>(IdDecl);
+  if (!ObjcIdTypedef) {
+    Diag(Loc, diag::err_missing_id_definition);
+    return QualType();
   }
+  Context.setObjcIdType(ObjcIdTypedef);
   return Context.getObjcIdType();
 }
 
index c23ed69b1b577c03a8cfa8065d5eaf2d36d3a533..4f59fe12789ad44b1a515f1e2fce420a9ac14b74 100644 (file)
@@ -1194,9 +1194,9 @@ Sema::DeclTy *Sema::ActOnStartCategoryImplementation(
   if (!IDecl || IDecl->isForwardDecl())
     Diag(ClassLoc, diag::err_undef_interface, ClassName->getName());
   
-  // We cannot build type 'id' laziliy. It is needed when checking if a 
+  // We cannot build type 'id' lazily. It is needed when checking if a 
   // type is an 'id' (via call to isObjcIdType) even if there is no
-  // need for the dafult 'id' type.
+  // need for the default 'id' type.
   // FIXME: Depending on the need to compare to 'id', this may have to go
   // somewhere else. At this time, this is a good enough place to do type
   // encoding of methods and ivars for the rewrite client.