[PATCH] D55212: Handle alloc_size attribute on function pointers

Alexander Richardson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 10 12:04:34 PST 2018


arichardson marked an inline comment as done.
arichardson added inline comments.


================
Comment at: test/Misc/pragma-attribute-supported-attributes-list.test:15
+// FIXME: After changing the subject from Function to HasFunctionProto, AllocSize is no longer listed (similar to Format, etc)
+// FIXME-NEXT: AllocSize (SubjectMatchRule_function)
 // CHECK-NEXT: AlwaysDestroy (SubjectMatchRule_variable)
----------------
aaron.ballman wrote:
> arichardson wrote:
> > This seems to also affect __attribute((format)) and others so I'm not sure whether removing AllocSize from this list is a blocker for this patch.
> I believe you may need to add an `AttrSubjectMatcherSubRule` in Attr.td to expose the attribute for `#pragma clang attribute` support. Can you see if you can support it instead of shrinking this list? Otherwise, I worry that this change will break code that was using the pragma to apply the attribute to declarations.
The problem here already has a fixme in attr.td:

```
  // FIXME: There's a matcher ambiguity with objc methods and blocks since
  // functionType excludes them but functionProtoType includes them.
  // AttrSubjectMatcherSubRule<"functionProtoType", [HasFunctionProto]>
```

It seems like this was already added as part of the initial pragma clang attribute commit in https://reviews.llvm.org/D30009

I had a look at the AttrEmitter.cpp in tablegen but couldn't find a straightforward solution.
I'll add @arphaman to the review.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55212/new/

https://reviews.llvm.org/D55212





More information about the cfe-commits mailing list