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

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 3 07:51:15 PDT 2023


Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>,
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.org/llvm/llvm-project/pull/67095 at github.com>


================
@@ -8938,6 +8957,11 @@ static void processTypeAttrs(TypeProcessingState &state, QualType &type,
       attr.setUsedAsTypeAttr();
       break;
     }
+    case ParsedAttr::AT_RequiresCapability: {
+      HandleRequiresCapabilityAttr(state, type, attr);
+      attr.setUsedAsTypeAttr();
+      break;
+    }
----------------
AaronBallman wrote:

Okay, maybe we do want to do this change separately. I think I was wrong about modeling after this; I think we want it to be done like `handleFunctionTypeAttr()` and `FUNCTION_TYPE_ATTRS_CASELIST` so that it becomes part of the `FunctionType` itself. That's what would get us the diagnostics on type mismatches (we look through `AttributedType` as sugar: https://github.com/llvm/llvm-project/blob/28b7e281d4eaea0d5d56b1a4cf7a550be746a007/clang/include/clang/AST/Type.h#L4999)

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


More information about the cfe-commits mailing list