[cfe-commits] r103870 - in /cfe/trunk: include/clang/AST/ include/clang/Frontend/ lib/AST/ lib/Checker/ lib/CodeGen/ lib/Frontend/ lib/Index/ lib/Sema/ test/SemaObjCXX/ tools/libclang/

Douglas Gregor dgregor at apple.com
Sat May 15 09:03:47 PDT 2010


On May 15, 2010, at 4:32 AM, John McCall wrote:

> Author: rjmccall
> Date: Sat May 15 06:32:37 2010
> New Revision: 103870
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=103870&view=rev
> Log:
> Substantially alter the design of the Objective C type AST by introducing
> ObjCObjectType, which is basically just a pair of
>  one of {primitive-id, primitive-Class, user-defined @class}
> with
>  a list of protocols.
> An ObjCObjectPointerType is therefore just a pointer which always points to
> one of these types (possibly sugared).  ObjCInterfaceType is now just a kind
> of ObjCObjectType which happens to not carry any protocols.

Very nice!

> Alter a rather large number of use sites to use ObjCObjectType instead of
> ObjCInterfaceType.  Store an ObjCInterfaceType as a pointer on the decl rather
> than hashing them in a FoldingSet.  Remove some number of methods that are no
> longer used, at least after this patch.
> 
> By simplifying ObjCObjectPointerType, we are now able to easily remove and apply
> pointers to Objective-C types, which is crucial for a certain kind of ObjC++
> metaprogramming common in WebKit.

It looks like this fits into our type system well, now.

> Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=103870&r1=103869&r2=103870&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
> +++ cfe/trunk/lib/CodeGen/Mangle.cpp Sat May 15 06:32:37 2010
> @@ -1206,6 +1206,12 @@
>   mangleSourceName(T->getDecl()->getIdentifier());
> }
> 
> +void CXXNameMangler::mangleType(const ObjCObjectType *T) {
> +  // FIXME: do we allow overloading by different protocols?
> +  // If so, we need to mangle them in here.
> +  mangleType(T->getBaseType());
> +}
> +
> void CXXNameMangler::mangleType(const BlockPointerType *T) {
>   Out << "U13block_pointer";
>   mangleType(T->getPointeeType());

We don't allow overloading by different protocols, so we don't need to mangle the protocol; Sema checks for this in Sema::IsOverload.

	- Doug



More information about the cfe-commits mailing list