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

Gábor Horváth via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 06:16:19 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)) {
+  }
+
+  SplitQualType Split = ParamType.split();
+  QualType Unqualified(Split.Ty, 0);
+  QualType Result = Unqualified;
+
+  if (const auto *PT = llvm::dyn_cast<PointerType>(Unqualified.getTypePtr())) {
----------------
Xazax-hun wrote:

I think it might be easy to miss some cases, e.g., if the nullability qualifier is in an array type, or a function pointer type. I wonder if this could be written with a `TypeVisitor` that would be guaranteed to visit every component of a type. 

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


More information about the cfe-commits mailing list