[PATCH] D23895: [ms] Add support for parsing uuid as a MS attribute

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 25 16:32:32 PDT 2016


thakis created this revision.
thakis added a reviewer: rnk.
thakis added a subscriber: cfe-commits.

Some Windows SDK classes, for example Windows::Storage::Streams::IBufferByteAccess, use the ATL way of spelling attributes:

  [uuid("....")] class IBufferByteAccess {};

To be able to use __uuidof() to grab the uuid off these types, clang needs to support uuid as a Microsoft attribute. There was already code to skip Microsoft attributes, extend that to look for uuid and parse it (using the existing code to parse the same attribute in __declspec). Add a new "MS" attribute type for this syntax.

There's already a function that moves attributes off the declspec into an attribute list for attributes applying to the type, teach that function to also move MS attributes around.  This requires that MS attributes make it to the DS in the first place, so move the call to MaybeParseMicrosoftAttributes() into ParseDeclOrFunctionDefInternal() so that it can store its results in DS.getAttributes().

https://reviews.llvm.org/D23895

Files:
  include/clang/Basic/Attr.td
  include/clang/Basic/Attributes.h
  include/clang/Parse/Parser.h
  include/clang/Sema/AttributeList.h
  lib/Parse/ParseDecl.cpp
  lib/Parse/ParseDeclCXX.cpp
  lib/Parse/ParseObjc.cpp
  lib/Parse/ParseOpenMP.cpp
  lib/Parse/Parser.cpp
  test/Parser/MicrosoftExtensions.cpp
  test/Sema/MicrosoftExtensions.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23895.69302.patch
Type: text/x-patch
Size: 14606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160825/711a80f1/attachment-0001.bin>


More information about the cfe-commits mailing list