[PATCH] D70469: [attributes] [analyzer] Add handle related attributes

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Dec 8 09:50:42 PST 2019


xazax.hun marked an inline comment as done.
xazax.hun added inline comments.


================
Comment at: clang/lib/Sema/SemaType.cpp:7424
+                             ParsedAttr &Attr) {
+  if (CurType->isFunctionType()) {
+    State.getSema().Diag(Attr.getLoc(), diag::warn_type_attribute_wrong_type)
----------------
aaron.ballman wrote:
> aaron.ballman wrote:
> > Is this correct, or should it be `if (!CurType->isFunctionType())`?
> I see now that this is only incorrect for the acquire attribute, but not the other two.
I think we might consider it incorrect for the acquire as well. Because if we let the user put acquire on the function, it is ambiguous where to put the annotation. If we do not let them put on the function they are always forced to put on the return type to express this. But in case this kind of ambiguity is a feature and not a bug I can change the behavior.


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

https://reviews.llvm.org/D70469





More information about the cfe-commits mailing list