[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:34 PST 2024
================
@@ -7539,74 +7559,65 @@ static NullabilityKind mapNullabilityAttrKind(ParsedAttr::Kind kind) {
}
}
-/// Applies a nullability type specifier to the given type, if possible.
-///
-/// \param state The type processing state.
-///
-/// \param type The type to which the nullability specifier will be
-/// added. On success, this type will be updated appropriately.
-///
-/// \param attr The attribute as written on the type.
-///
-/// \param allowOnArrayType Whether to accept nullability specifiers on an
-/// array type (e.g., because it will decay to a pointer).
-///
-/// \returns true if a problem has been diagnosed, false on success.
-static bool checkNullabilityTypeSpecifier(TypeProcessingState &state,
- QualType &type,
- ParsedAttr &attr,
- bool allowOnArrayType) {
- Sema &S = state.getSema();
-
- NullabilityKind nullability = mapNullabilityAttrKind(attr.getKind());
- SourceLocation nullabilityLoc = attr.getLoc();
- bool isContextSensitive = attr.isContextSensitiveKeywordAttribute();
-
- recordNullabilitySeen(S, nullabilityLoc);
+static bool CheckNullabilityTypeSpecifier(
+ Sema &S, TypeProcessingState *State, ParsedAttr *PAttr, QualType &QT,
+ NullabilityKind Nullability, SourceLocation NullabilityLoc,
+ bool IsContextSensitive, bool AllowOnArrayType, bool OverrideExisting) {
+ bool Implicit = (State == nullptr);
+ if (!Implicit)
+ recordNullabilitySeen(S, NullabilityLoc);
// Check for existing nullability attributes on the type.
- QualType desugared = type;
- while (auto attributed = dyn_cast<AttributedType>(desugared.getTypePtr())) {
+ QualType Desugared = QT;
+ while (auto Attributed = dyn_cast<AttributedType>(Desugared.getTypePtr())) {
----------------
egorzhdan wrote:
Done
https://github.com/llvm/llvm-project/pull/73017
More information about the cfe-commits
mailing list