File tree Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Expand file tree Collapse file tree 2 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -1527,20 +1527,20 @@ struct DeclaratorChunk {
1527
1527
1528
1528
// / Retrieve the location of the 'const' qualifier.
1529
1529
SourceLocation getConstQualifierLoc () const {
1530
- return MethodQualifiers ? MethodQualifiers-> getConstSpecLoc ()
1531
- : SourceLocation ();
1530
+ assert (MethodQualifiers);
1531
+ return MethodQualifiers-> getConstSpecLoc ();
1532
1532
}
1533
1533
1534
1534
// / Retrieve the location of the 'volatile' qualifier.
1535
1535
SourceLocation getVolatileQualifierLoc () const {
1536
- return MethodQualifiers ? MethodQualifiers-> getVolatileSpecLoc ()
1537
- : SourceLocation ();
1536
+ assert (MethodQualifiers);
1537
+ return MethodQualifiers-> getVolatileSpecLoc ();
1538
1538
}
1539
1539
1540
1540
// / Retrieve the location of the 'restrict' qualifier.
1541
1541
SourceLocation getRestrictQualifierLoc () const {
1542
- return MethodQualifiers ? MethodQualifiers-> getRestrictSpecLoc ()
1543
- : SourceLocation ();
1542
+ assert (MethodQualifiers);
1543
+ return MethodQualifiers-> getRestrictSpecLoc ();
1544
1544
}
1545
1545
1546
1546
// / Retrieve the location of the 'mutable' qualifier, if any.
Original file line number Diff line number Diff line change @@ -9223,13 +9223,14 @@ static NamedDecl *DiagnoseInvalidRedeclaration(
9223
9223
if (const auto &FTI = ExtraArgs.D.getFunctionTypeInfo(); !NewFDisConst)
9224
9224
DB << FixItHint::CreateInsertion(FTI.getRParenLoc().getLocWithOffset(1),
9225
9225
" const");
9226
- else if (SourceLocation ConstLoc = FTI.getConstQualifierLoc();
9227
- ConstLoc .isValid())
9228
- DB << FixItHint::CreateRemoval(ConstLoc );
9229
- } else
9226
+ else if (FTI.hasMethodTypeQualifiers() &&
9227
+ FTI.getConstQualifierLoc() .isValid())
9228
+ DB << FixItHint::CreateRemoval(FTI.getConstQualifierLoc() );
9229
+ } else {
9230
9230
SemaRef.Diag(FD->getLocation(),
9231
9231
IsMember ? diag::note_member_def_close_match
9232
9232
: diag::note_local_decl_close_match);
9233
+ }
9233
9234
}
9234
9235
return nullptr;
9235
9236
}
You can’t perform that action at this time.
0 commit comments