summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaAccess.cpp
diff options
context:
space:
mode:
authorKaelyn Uhrain <rikka@google.com>2013-09-26 19:10:29 +0000
committerKaelyn Uhrain <rikka@google.com>2013-09-26 19:10:29 +0000
commit95995be7a35167e404a844b7156448814c33d7ea (patch)
tree6cd450caf17e6d84ecc1248aa8e3cb4326b2f9bb /clang/lib/Sema/SemaAccess.cpp
parente228d1070909d55a253640a0c50046a969f0bff2 (diff)
downloadbcm5719-llvm-95995be7a35167e404a844b7156448814c33d7ea.tar.gz
bcm5719-llvm-95995be7a35167e404a844b7156448814c33d7ea.zip
Teach typo correction to look inside of classes like it does namespaces.
Unlike with namespaces, searching inside of classes requires also checking the access to correction candidates (i.e. don't suggest a correction to a private class member for a correction occurring outside that class and its methods or friends). Included is a small (one line) fix for a bug, that was uncovered while cleaning up the unit tests, where the decls from a TypoCorrection candidate were preserved in new TypoCorrection candidates that are derived (copied) from the old TypoCorrection--notably when creating a new candidate by changing the NestedNameSpecifier associated with the base idenitifer. llvm-svn: 191449
Diffstat (limited to 'clang/lib/Sema/SemaAccess.cpp')
-rw-r--r--clang/lib/Sema/SemaAccess.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaAccess.cpp b/clang/lib/Sema/SemaAccess.cpp
index 4ecbf0ba776..6dbfad4e18d 100644
--- a/clang/lib/Sema/SemaAccess.cpp
+++ b/clang/lib/Sema/SemaAccess.cpp
@@ -1390,6 +1390,8 @@ static AccessResult IsAccessible(Sema &S,
CXXBasePath *Path = FindBestPath(S, EC, Entity, FinalAccess, Paths);
if (!Path)
return AR_dependent;
+ if (Path->Access == AS_none) // This can happen during typo correction.
+ return AR_inaccessible;
assert(Path->Access <= UnprivilegedAccess &&
"access along best path worse than direct?");
OpenPOWER on IntegriCloud