[cfe-commits] r135304 - /cfe/trunk/include/clang/AST/DeclObjC.h

Argyrios Kyrtzidis kyrtzidis at apple.com
Fri Jul 15 15:28:42 PDT 2011


On Jul 15, 2011, at 3:11 PM, Douglas Gregor wrote:

> 
> On Jul 15, 2011, at 3:04 PM, Argyrios Kyrtzidis wrote:
> 
>> 
>> On Jul 15, 2011, at 2:49 PM, Douglas Gregor wrote:
>> 
>>> 
>>> On Jul 15, 2011, at 2:39 PM, Argyrios Kyrtzidis wrote:
>>> 
>>>> Author: akirtzidis
>>>> Date: Fri Jul 15 16:39:32 2011
>>>> New Revision: 135304
>>>> 
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=135304&view=rev
>>>> Log:
>>>> The canonical decl for an ObjCImplDecl is it's interface class. Fixes rdar://8728637.
>>>> 
>>>> Modified:
>>>> cfe/trunk/include/clang/AST/DeclObjC.h
>>>> 
>>>> Modified: cfe/trunk/include/clang/AST/DeclObjC.h
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=135304&r1=135303&r2=135304&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/include/clang/AST/DeclObjC.h (original)
>>>> +++ cfe/trunk/include/clang/AST/DeclObjC.h Fri Jul 15 16:39:32 2011
>>>> @@ -1122,6 +1122,12 @@
>>>>    ClassInterface(classInterface) {}
>>>> 
>>>> public:
>>>> +  virtual Decl *getCanonicalDecl() {
>>>> +    if (Decl *interface = getClassInterface())
>>>> +      return interface;
>>>> +    return this;
>>>> +  }
>>>> +
>>> 
>>> I think this change should be limited to libclang's clang_getCanonicalCursor(). Sema and AST are almost certainly not ready for getCanonicalCursor() to change the kind of declaration node except in the *very* limited cases corresponding to using declarations.
>> 
>> How does it affect negatively Sema and AST, could you give an example ?
> 
> It's assumed that calling getCanonicalDecl() on a declaration returns a declaration of the same kind… but interfaces and implementations are handled very differently (especially in Sema), so getCanonicalDecl() should not map one to the other.
> 
> It's really only in the libclang world where we want to equate interfaces and implementations. The same issue occurs with categories and category implementations.

Ok, done in r135314.

> 
> 	- Doug
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list