[cfe-commits] r67249 - in /cfe/trunk: include/clang/AST/DeclObjC.h include/clang/Parse/Action.h lib/CodeGen/CodeGenModule.cpp lib/Parse/ParseObjc.cpp lib/Sema/Sema.h lib/Sema/SemaDeclObjC.cpp test/CodeGenObjC/interface-tu-variable.m

Fariborz Jahanian fjahanian at apple.com
Wed Mar 18 16:24:31 PDT 2009


On Mar 18, 2009, at 3:58 PM, steve naroff wrote:

>
> On Mar 18, 2009, at 6:33 PM, Fariborz Jahanian wrote:
>
>> Author: fjahanian
>> Date: Wed Mar 18 17:33:24 2009
>> New Revision: 67249
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=67249&view=rev
>> Log:
>> objc: Implemented variables declared in class interface
>> whose sema decl is at the translation unit.
>>
>> Added:
>>   cfe/trunk/test/CodeGenObjC/interface-tu-variable.m
>> Modified:
>>   cfe/trunk/include/clang/AST/DeclObjC.h
>>   cfe/trunk/include/clang/Parse/Action.h
>>   cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>>   cfe/trunk/lib/Parse/ParseObjc.cpp
>>   cfe/trunk/lib/Sema/Sema.h
>>   cfe/trunk/lib/Sema/SemaDeclObjC.cpp
>>
>> Modified: cfe/trunk/include/clang/AST/DeclObjC.h
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=67249&r1=67248&r2=67249&view=diff
>>
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =
>> =====================================================================
>> --- cfe/trunk/include/clang/AST/DeclObjC.h (original)
>> +++ cfe/trunk/include/clang/AST/DeclObjC.h Wed Mar 18 17:33:24 2009
>> @@ -246,6 +246,11 @@
>> ///
>> class ObjCContainerDecl : public NamedDecl, public DeclContext {
>>  SourceLocation AtEndLoc; // marks the end of the method container.
>> +  // FIXME. In the long term, all TU variables declared in class  
>> scope belong
>> +  // to class's decl context. This waits till we can establish  
>> class's
>> +  // context before processing all decls in the class.
>> +  /// Instance variables in the interface.
>> +  ObjCList<VarDecl> TUVars;
>
> Fariborz,
>
> Since this idiom is extremely uncommon, I'd prefer we don't add a  
> list to every ObjCContainerDecl.
>
> What's the problem with inserting these in the "right" context from  
> the beginning?

This was my original attempt at implementation. It turns out that for  
these
variables,  lexical context is one of interface/protocol/category. The  
sema
context is TU. The scoping implementation for objc classes does not  
allow for this.
After talking to Doug, we decided that for long term, we need to
push to class context before we parse any declaration for such things  
as methods, etc.
and move the variables up the scope to TU context.

- Fariborz

>



More information about the cfe-commits mailing list