[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

Steve Naroff snaroff at apple.com
Wed Oct 10 11:01:10 PDT 2007


On Oct 10, 2007, at 10:52 AM, Chris Lattner wrote:

>
> 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?
>

I already planned on refactoring this a bit today. I will likely add  
a getter which caches the result...

snaroff

> -Chris




More information about the cfe-commits mailing list