[clang] [APINotes] Strip selector volatile and nested nullability from parameter selectors (PR #215266)

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 06:54:29 PDT 2026


================
@@ -1001,11 +994,35 @@ UnwindTagContext(TagDecl *DC, api_notes::APINotesManager &APINotes) {
   return std::nullopt;
 }
 
-static void stripAPINotesParameterNullability(QualType &ParamType) {
-  while (true) {
-    if (!AttributedType::stripOuterNullability(ParamType))
-      return;
+static QualType stripAPINotesParameterNullability(QualType ParamType,
+                                                  const ASTContext &Context) {
+  while (AttributedType::stripOuterNullability(ParamType)) {
----------------
StoeckOverflow wrote:

I kept this as a loop because `stripOuterNullability` removes only one immediate outer nullability attribute wrapper per call.

For example, Clang accepts spellings where nullability can come from both an alias and the use site:

```objc
typedef int * _Nullable NullableIntPtr;
void f(NullableIntPtr _Nullable);
```

The loop removes all consecutive outer nullability wrappers, if present, before we recurse into pointee types.

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


More information about the cfe-commits mailing list