forked from OSchip/llvm-project
[Sema][ObjC] Check whether a DelayedDiagnosticPool has been pushed
before adding a delayed diagnostic to DelayedDiagnostics. This fixes an assertion failure in Sema::DelayedDiagnostics::add that was caused by the changes made in r141037. rdar://problem/42782323 llvm-svn: 351911
This commit is contained in:
parent
7a3108ff0f
commit
957accaef0
|
|
@ -12545,9 +12545,13 @@ ParmVarDecl *Sema::CheckParameter(DeclContext *DC, SourceLocation StartLoc,
|
||||||
// - otherwise, it's an error
|
// - otherwise, it's an error
|
||||||
if (T->isArrayType()) {
|
if (T->isArrayType()) {
|
||||||
if (!T.isConstQualified()) {
|
if (!T.isConstQualified()) {
|
||||||
DelayedDiagnostics.add(
|
if (DelayedDiagnostics.shouldDelayDiagnostics())
|
||||||
sema::DelayedDiagnostic::makeForbiddenType(
|
DelayedDiagnostics.add(
|
||||||
NameLoc, diag::err_arc_array_param_no_ownership, T, false));
|
sema::DelayedDiagnostic::makeForbiddenType(
|
||||||
|
NameLoc, diag::err_arc_array_param_no_ownership, T, false));
|
||||||
|
else
|
||||||
|
Diag(NameLoc, diag::err_arc_array_param_no_ownership)
|
||||||
|
<< TSInfo->getTypeLoc().getSourceRange();
|
||||||
}
|
}
|
||||||
lifetime = Qualifiers::OCL_ExplicitNone;
|
lifetime = Qualifiers::OCL_ExplicitNone;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -101,3 +101,13 @@ namespace rdar12078752 {
|
||||||
__autoreleasing auto o3 = o;
|
__autoreleasing auto o3 = o;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace test_err_arc_array_param_no_ownership {
|
||||||
|
template <class T>
|
||||||
|
void func(T a) {}
|
||||||
|
|
||||||
|
void test() {
|
||||||
|
func([](A *a[]){}); // expected-error{{must explicitly describe intended ownership of an object array parameter}}
|
||||||
|
func(^(A *a[]){}); // expected-error{{must explicitly describe intended ownership of an object array parameter}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue