summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorKaelyn Takata <rikka@google.com>2014-11-11 23:00:40 +0000
committerKaelyn Takata <rikka@google.com>2014-11-11 23:00:40 +0000
commite9e4ecfe9ede8ec8c44dea1ffdfb1e6d60ca08cf (patch)
treeae59e7c04153a3361e7af0224a73ae07ba960a70 /clang/lib/Sema
parentdb99de2d15b99abd562f401aca66049d14337114 (diff)
downloadbcm5719-llvm-e9e4ecfe9ede8ec8c44dea1ffdfb1e6d60ca08cf.tar.gz
bcm5719-llvm-e9e4ecfe9ede8ec8c44dea1ffdfb1e6d60ca08cf.zip
Explicitly exclude keywords from the member validator.
Also simply and remove dead code from MemberExprTypoRecovery. llvm-svn: 221723
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaExprMember.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp
index 1f174412863..f77332114c9 100644
--- a/clang/lib/Sema/SemaExprMember.cpp
+++ b/clang/lib/Sema/SemaExprMember.cpp
@@ -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();
OpenPOWER on IntegriCloud