Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 188f114

Browse files
committed
Merge remote-tracking branch 'origin/swift-5.1-branch' into stable
2 parents e8df214 + 6856cf4 commit 188f114

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

lib/Sema/SemaType.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4189,7 +4189,7 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
41894189
auto inferPointerNullability =
41904190
[&](SimplePointerKind pointerKind, SourceLocation pointerLoc,
41914191
SourceLocation pointerEndLoc,
4192-
ParsedAttributesView &attrs) -> ParsedAttr * {
4192+
ParsedAttributesView &attrs, AttributePool &Pool) -> ParsedAttr * {
41934193
// We've seen a pointer.
41944194
if (NumPointersRemaining > 0)
41954195
--NumPointersRemaining;
@@ -4203,11 +4203,9 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
42034203
ParsedAttr::Syntax syntax = inferNullabilityCS
42044204
? ParsedAttr::AS_ContextSensitiveKeyword
42054205
: ParsedAttr::AS_Keyword;
4206-
ParsedAttr *nullabilityAttr =
4207-
state.getDeclarator().getAttributePool().create(
4208-
S.getNullabilityKeyword(*inferNullability),
4209-
SourceRange(pointerLoc), nullptr, SourceLocation(), nullptr, 0,
4210-
syntax);
4206+
ParsedAttr *nullabilityAttr = Pool.create(
4207+
S.getNullabilityKeyword(*inferNullability), SourceRange(pointerLoc),
4208+
nullptr, SourceLocation(), nullptr, 0, syntax);
42114209

42124210
attrs.addAtEnd(nullabilityAttr);
42134211

@@ -4266,7 +4264,8 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
42664264
if (auto *attr = inferPointerNullability(
42674265
pointerKind, D.getDeclSpec().getTypeSpecTypeLoc(),
42684266
D.getDeclSpec().getEndLoc(),
4269-
D.getMutableDeclSpec().getAttributes())) {
4267+
D.getMutableDeclSpec().getAttributes(),
4268+
D.getMutableDeclSpec().getAttributePool())) {
42704269
T = state.getAttributedType(
42714270
createNullabilityAttr(Context, *attr, *inferNullability), T, T);
42724271
}
@@ -4306,7 +4305,8 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
43064305

43074306
// Handle pointer nullability.
43084307
inferPointerNullability(SimplePointerKind::BlockPointer, DeclType.Loc,
4309-
DeclType.EndLoc, DeclType.getAttrs());
4308+
DeclType.EndLoc, DeclType.getAttrs(),
4309+
state.getDeclarator().getAttributePool());
43104310

43114311
T = S.BuildBlockPointerType(T, D.getIdentifierLoc(), Name);
43124312
if (DeclType.Cls.TypeQuals || LangOpts.OpenCL) {
@@ -4328,7 +4328,8 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
43284328

43294329
// Handle pointer nullability
43304330
inferPointerNullability(SimplePointerKind::Pointer, DeclType.Loc,
4331-
DeclType.EndLoc, DeclType.getAttrs());
4331+
DeclType.EndLoc, DeclType.getAttrs(),
4332+
state.getDeclarator().getAttributePool());
43324333

43334334
if (LangOpts.ObjC && T->getAs<ObjCObjectType>()) {
43344335
T = Context.getObjCObjectPointerType(T);
@@ -4843,7 +4844,8 @@ static TypeSourceInfo *GetFullTypeForDeclarator(TypeProcessingState &state,
48434844

48444845
// Handle pointer nullability.
48454846
inferPointerNullability(SimplePointerKind::MemberPointer, DeclType.Loc,
4846-
DeclType.EndLoc, DeclType.getAttrs());
4847+
DeclType.EndLoc, DeclType.getAttrs(),
4848+
state.getDeclarator().getAttributePool());
48474849

48484850
if (SS.isInvalid()) {
48494851
// Avoid emitting extra errors if we already errored on the scope.

test/SemaObjC/nonnull.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,9 @@ void PR18795_helper() {
125125
}
126126

127127
void (^PR23117)(int *) = ^(int *p1) __attribute__((nonnull(1))) {};
128+
129+
typedef int *intptr;
130+
#pragma clang assume_nonnull begin
131+
intptr a, b;
132+
intptr c, (*d)();
133+
#pragma clang assume_nonnull end

0 commit comments

Comments
 (0)