diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-04-14 20:04:41 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-04-14 20:04:41 +0000 |
commit | 280e1ee0ae44f161971539ad6ab965169b932ae9 (patch) | |
tree | 31621cbbc1e63f6bf5865974a5e6481e71c610eb /clang/lib/Sema/SemaInit.cpp | |
parent | 7deb447781bee7639ffb12a31c8e4f74a2ba9db8 (diff) | |
download | bcm5719-llvm-280e1ee0ae44f161971539ad6ab965169b932ae9.tar.gz bcm5719-llvm-280e1ee0ae44f161971539ad6ab965169b932ae9.zip |
Teach typo correction about various language keywords. We can't
generally recover from typos in keywords (since we would effectively
have to mangle the token stream). However, there are still benefits to
typo-correcting with keywords:
- We don't make stupid suggestions when the user typed something
that is similar to a keyword.
- We can suggest the keyword in a diagnostic (did you mean
"static_cast"?), even if we can't recover and therefore don't have
a fix-it.
llvm-svn: 101274
Diffstat (limited to 'clang/lib/Sema/SemaInit.cpp')
-rw-r--r-- | clang/lib/Sema/SemaInit.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 52a5cb13724..dae3d3ae7e6 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -1354,7 +1354,8 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity, // was a typo for another field name. LookupResult R(SemaRef, FieldName, D->getFieldLoc(), Sema::LookupMemberName); - if (SemaRef.CorrectTypo(R, /*Scope=*/0, /*SS=*/0, RT->getDecl()) && + if (SemaRef.CorrectTypo(R, /*Scope=*/0, /*SS=*/0, RT->getDecl(), false, + Sema::CTC_NoKeywords) && (ReplacementField = R.getAsSingle<FieldDecl>()) && ReplacementField->getDeclContext()->getLookupContext() ->Equals(RT->getDecl())) { |