[cfe-commits] r42817 - in /cfe/trunk: AST/ASTContext.cpp Parse/Parser.cpp Sema/Sema.cpp Sema/Sema.h Sema/SemaDecl.cpp clang.xcodeproj/project.pbxproj include/clang/Parse/Action.h test/Sema/selector-overload.m

Chris Lattner clattner at apple.com
Wed Oct 10 10:52:54 PDT 2007


On Oct 9, 2007, at 3:01 PM, Steve Naroff wrote:

> @@ -1782,7 +1782,18 @@
>                                VarDecl::None, 0);
>      Params.push_back(Param);
>    }
> -  QualType resultDeclType = QualType::getFromOpaquePtr(ReturnType);
> +  QualType resultDeclType;
> +
> +  if (ReturnType)
> +    resultDeclType = QualType::getFromOpaquePtr(ReturnType);
> +  else { // get the type for "id".
> +    IdentifierInfo *IdIdent = &Context.Idents.get("id");
> +    ScopedDecl *IdDecl = LookupScopedDecl(IdIdent,  
> Decl::IDNS_Ordinary,
> +                                          SourceLocation(), TUScope);
> +    TypedefDecl *IdTypedef = dyn_cast_or_null<TypedefDecl>(IdDecl);
> +    assert(IdTypedef && "ActOnMethodDeclaration(): Couldn't find  
> 'id' type");
> +    resultDeclType = IdTypedef->getUnderlyingType();
> +  }

Hi Steve,

Should the "id" identifierinfo* be cached in Sema as an ivar?  or  
perhaps the TypedefDecl should be?  How common are missing types?

-Chris



More information about the cfe-commits mailing list