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

Nico Weber via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 30 11:34:06 PDT 2016


thakis marked 3 inline comments as done.
thakis added a comment.

> There are things missing from this patch as well. To wit:

> 

> - Attributes.h needs to know about this attribute syntax, and `hasAttribute()` needs to support it (this hooks into `__has_attribute` support).

> - AttributeList.h should be updated to expose the parsed attribute syntax.

> - Both of these changes should be threaded through ClangAttrEmitter.cpp.


All these are already part of this patch as far as I can tell. What am I missing?


================
Comment at: lib/Parse/ParseDecl.cpp:1427-1428
@@ -1425,2 +1426,4 @@
 
+// Usually, `__attribute__((attrib)) class Foo {} var` means that attrib applies
+// to var, not the type Foo.
 // As an exception to the rule, __declspec(align(...)) before the
----------------
aaron.ballman wrote:
> I'd spell this out a bit more.
> ```
> // Usually, `__attribute__((attrib)) class Foo {} var;` means that the attribute appertains to the declaration (var) rather than the type (Foo).
> ```
> 
(ish)

================
Comment at: lib/Parse/ParseDecl.cpp:1431
@@ -1427,4 +1430,3 @@
 // class-key affects the type instead of the variable.
-void Parser::handleDeclspecAlignBeforeClassKey(ParsedAttributesWithRange &Attrs,
-                                               DeclSpec &DS,
-                                               Sema::TagUseKind TUK) {
+// Also, Microsoft-style [attributes] affect the type instead of the variable.
+// This function moves attributes that should apply to the type off DS to Attrs.
----------------
aaron.ballman wrote:
> Is this documented somewhere, or just what you gather from experimentation?
Experimentation.

================
Comment at: utils/TableGen/ClangAttrEmitter.cpp:2372
@@ -2363,3 +2371,3 @@
                 .Case("Declspec", 2)
-                .Case("Keyword", 3)
-                .Case("Pragma", 4)
+                .Case("Microsoft", 3)
+                .Case("Keyword", 4)
----------------
aaron.ballman wrote:
> I think (but my memory is a bit fuzzy here) that these values need to match the ones from AttributeList.h. I think it's a bug that Pragma was at 4 rather than 5, but since __has_attribute doesn't care about pragmas (or context sensitive keywords), it's likely benign.
I can change pragma to map to one more in a separate patch if you want.


https://reviews.llvm.org/D23895





More information about the cfe-commits mailing list