[clang] [APINotes] Upstream Sema logic to apply API Notes to decls (PR #73017)

Egor Zhdan via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 15 06:22:31 PST 2024


================
@@ -7519,6 +7519,26 @@ static bool HandleWebAssemblyFuncrefAttr(TypeProcessingState &State,
   return false;
 }
 
+/// Rebuild an attributed type without the nullability attribute on it.
+static QualType rebuildAttributedTypeWithoutNullability(ASTContext &Ctx,
+                                                        QualType Type) {
+  auto Attributed = dyn_cast<AttributedType>(Type.getTypePtr());
+  if (!Attributed)
+    return Type;
+
+  // Skip the nullability attribute; we're done.
+  if (Attributed->getImmediateNullability()) {
+    return Attributed->getModifiedType();
+  }
+
+  // Build the modified type.
+  auto Modified = rebuildAttributedTypeWithoutNullability(
----------------
egorzhdan wrote:

This is a `QualType`, added the explicit type.

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


More information about the cfe-commits mailing list