mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 04:46:07 +00:00
Explicitly exclude keywords from the member validator.
Also simply and remove dead code from MemberExprTypoRecovery. llvm-svn: 221723
This commit is contained in:
parent
db99de2d15
commit
e9e4ecfe9e
@ -539,7 +539,15 @@ namespace {
|
||||
class RecordMemberExprValidatorCCC : public CorrectionCandidateCallback {
|
||||
public:
|
||||
explicit RecordMemberExprValidatorCCC(const RecordType *RTy)
|
||||
: Record(RTy->getDecl()) {}
|
||||
: Record(RTy->getDecl()) {
|
||||
// Don't add bare keywords to the consumer since they will always fail
|
||||
// validation by virtue of not being associated with any decls.
|
||||
WantTypeSpecifiers = false;
|
||||
WantExpressionKeywords = false;
|
||||
WantCXXNamedCasts = false;
|
||||
WantFunctionLikeCasts = false;
|
||||
WantRemainingKeywords = false;
|
||||
}
|
||||
|
||||
bool ValidateCandidate(const TypoCorrection &candidate) override {
|
||||
NamedDecl *ND = candidate.getCorrectionDecl();
|
||||
@ -1214,9 +1222,6 @@ public:
|
||||
OpLoc(OpLoc), IsArrow(IsArrow) {}
|
||||
|
||||
ExprResult operator()(Sema &SemaRef, TypoExpr *TE, TypoCorrection TC) {
|
||||
if (TC.isKeyword())
|
||||
return ExprError();
|
||||
|
||||
LookupResult R(SemaRef, TC.getCorrection(),
|
||||
TC.getCorrectionRange().getBegin(),
|
||||
SemaRef.getTypoExprState(TE)
|
||||
@ -1224,12 +1229,6 @@ public:
|
||||
.getLookupKind());
|
||||
R.suppressDiagnostics();
|
||||
|
||||
QualType BaseType;
|
||||
if (auto *DRE = dyn_cast<DeclRefExpr>(BaseExpr))
|
||||
BaseType = DRE->getDecl()->getType();
|
||||
else if (auto *CE = dyn_cast<CallExpr>(BaseExpr))
|
||||
BaseType = CE->getCallReturnType();
|
||||
|
||||
for (NamedDecl *ND : TC)
|
||||
R.addDecl(ND);
|
||||
R.resolveKind();
|
||||
|
Loading…
x
Reference in New Issue
Block a user