[cfe-dev] [Proposal] How i plan to implement operator __uuidof
Francois Pichet
pichet2000 at gmail.com
Fri Dec 24 00:16:05 PST 2010
Here is my plan on how to implement the __uuidof operator.
doc: http://msdn.microsoft.com/en-us/library/zaah6a61(v=VS.90).aspx
For each class with an uuid attribute, clang would insert an implicit
declaration of type: VarDecl.
For example:
struct __declspec(uuid("00000000-0000-0000-0000-000000000001"))
type_uuid { };
will add an implicit VarDecl looking like this:
_GUID implicit_no_name = { 0, 0, 0, { 0, 0, 0, 0, 0, 0, 0, 1} };
A _GUID structure looks like this:
struct _GUID {
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[ 8 ];
};
A pointer to the implicit VarDecl object will be saved in the UuidAttr class
for later retrieval.
__uuidof will return a const reference to that VarDecl object.
Also, given this code:
template <const _GUID*> class T {};
T<&__uuidof(var)> foo;
The function CheckTemplateArgumentAddressOfObjectOrFunction will need to be
modified to accept an expression of type CXXUuidofExpr as "ArgIn"
All this only under -fms-extensions of course...
Any comments or potential problems with this approach?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101224/104f693a/attachment.html>
More information about the cfe-dev
mailing list