Skip to content

Commit

Permalink
Merge pull request #914 from apple/cherry-pick-58893199
Browse files Browse the repository at this point in the history
[Sema] Fix an assert when objc_externally_retained was applied to an …
  • Loading branch information
epilk committed Mar 17, 2020
2 parents 9f84085 + 002b092 commit 3138d90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion clang/lib/Sema/SemaDeclAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7008,7 +7008,9 @@ static void handleObjCExternallyRetainedAttr(Sema &S, Decl *D,

// If D is a function-like declaration (method, block, or function), then we
// make every parameter psuedo-strong.
for (unsigned I = 0, E = getFunctionOrMethodNumParams(D); I != E; ++I) {
unsigned NumParams =
hasFunctionProto(D) ? getFunctionOrMethodNumParams(D) : 0;
for (unsigned I = 0; I != NumParams; ++I) {
auto *PVD = const_cast<ParmVarDecl *>(getFunctionOrMethodParam(D, I));
QualType Ty = PVD->getType();

Expand Down
3 changes: 3 additions & 0 deletions clang/test/SemaObjC/externally-retained.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,6 @@ void test13(ObjCTy *first, __weak ObjCTy *second, __unsafe_unretained ObjCTy *th
}

#pragma clang attribute ext_ret.pop

__attribute__((objc_externally_retained))
void unprototyped();

0 comments on commit 3138d90

Please sign in to comment.