================
@@ -1668,6 +1656,25 @@ static bool checkCommonAttributeFeatures(Sema &S, const 
Ty *Node,
   return false;
 }
 
+template <typename Ty>
+static bool checkCommonAttributeFeatures(Sema &S, const Ty *Node,
+                                         const ParsedAttr &A,
+                                         bool SkipArgCountCheck) {
+  // Run the checks shared with type attributes (language options, target, and
+  // argument count). This also bails on unknown and ignored attributes.
+  if (checkCommonAttributeFeatures(S, A, SkipArgCountCheck))
+    return true;
+  // Check whether the attribute appertains to the given subject.
+  if (!A.diagnoseAppertainsTo(S, Node))
+    return true;
+  // Check whether the attribute is mutually exclusive with other attributes
+  // that have already been applied to the declaration.
+  if (!A.diagnoseMutualExclusion(S, Node))
+    return true;
----------------
elizabethandrews wrote:

> The type is essentially mid-construction when we process attributes. I am not 
> sure how that affects appertainment checks. For example, does 
> SubjectList<[Pointer]> mean the chunk that the attribute is applied to is a 
> pointer, or the overall type being qualified is a pointer?

I might be overthinking this. I just remembered we have individual checks 
inside handlers for appertainment for some handlers now.   So we can probably 
just use whatever `Type` (or `QualType` ?) is at the site.   

https://github.com/llvm/llvm-project/pull/227421
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to