[cfe-dev] [Windows] __uuidof support?

Aaron Ballman aaron at aaronballman.com
Wed Dec 4 05:26:34 PST 2013


On Wed, Dec 4, 2013 at 8:14 AM, Fredrik Orderud <forderud at gmail.com> wrote:
> It seems like there is no support for the "__uuidof" operator in clang. This
> operator is heavily used in conjunction to COM on Windows.
>
> Attempting to build a small Direct3D example code (attached) with "clang -v
> test.cpp -o test.exe" yields the following error:
> ---
> test.cpp:8:37: error: cannot yet mangle expression type CXXUuidofExpr
> _COM_SMARTPTR_TYPEDEF(ID3D10Device, __uuidof(ID3D10Device));
>                                     ^~~~~~~~~~~~~~~~~~~~~~
> c:\Program Files (x86)\Microsoft Visual Studio
> 10.0\VC\INCLUDE\comdef.h:296:60:
> note:
>       expanded from macro '_COM_SMARTPTR_TYPEDEF'
>     typedef _COM_SMARTPTR<_COM_SMARTPTR_LEVEL2<Interface, &IID> > \
>                                                            ^
> ---
> Clang was built from trunk yesterday.
>
> Can anyone tell me if there are any plans to implement "__uuidof" support in
> the near future? If not, should I register an Bugzilla issue on the problem?

Definitely file a bugzilla issue on __uuidof, but as for plans...
patches welcome.  ;-) We already have some support for
__declspec(uuid) to attach a uuid to a decl, so this would be a matter
of performing the proper lookups on an expression to find the proper
decl, see if it has the correct attribute attached to it, and pull the
GUID out of it. We don't have any support for IDL libraries, so that
would be a different situation entirely.

~Aaron



More information about the cfe-dev mailing list