[clang] [clang][TSA] Make RequiresCapability a DeclOrType attribute (PR #67095)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 19 06:45:17 PDT 2023


Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm/llvm-project/pull/67095/clang at github.com>


================
@@ -8602,6 +8602,31 @@ static void HandleAnnotateTypeAttr(TypeProcessingState &State,
   CurType = State.getAttributedType(AnnotateTypeAttr, CurType, CurType);
 }
 
+static void HandleRequiresCapabilityAttr(TypeProcessingState &State,
+                                         QualType &CurType,
+                                         const ParsedAttr &PA) {
+  Sema &S = State.getSema();
+
+  if (PA.getNumArgs() < 1) {
+    S.Diag(PA.getLoc(), diag::err_attribute_too_few_arguments) << PA << 1;
+    return;
+  }
+
+  // FIXME: We need to sanity check the arguments here I think? Like we do in
+  // SemaDeclAtr.cpp.
----------------
AaronBallman wrote:

Yup, this needs to be done manually because the helper code automatically generated by tablegen isn't yet smart enough to generate logic for type attributes. I think this work should be done as part of this commit instead of left as follow-up work.

https://github.com/llvm/llvm-project/pull/67095


More information about the cfe-commits mailing list