diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2018-08-02 17:59:51 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2018-08-02 17:59:51 +0000 |
| commit | 7cb19e8bd99e7a7f926ad363aa2b4dd58fb8e380 (patch) | |
| tree | 8d5195e81c160c2a7c7d93674e053a67d0f31092 /contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp | |
| parent | 1c4688a8498fea1db507842ff8dedaacad8ef77b (diff) | |
| parent | c7e70c433efc6953dc3888b9fbf9f3512d7da2b0 (diff) | |
Notes
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp')
| -rw-r--r-- | contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp b/contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp index 4e571eba17e9..30af826ef6cc 100644 --- a/contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp +++ b/contrib/llvm/tools/clang/lib/Sema/SemaCodeComplete.cpp @@ -1303,34 +1303,8 @@ namespace { void FoundDecl(NamedDecl *ND, NamedDecl *Hiding, DeclContext *Ctx, bool InBaseClass) override { bool Accessible = true; - if (Ctx) { - DeclContext *AccessingCtx = Ctx; - // If ND comes from a base class, set the naming class back to the - // derived class if the search starts from the derived class (i.e. - // InBaseClass is true). - // - // Example: - // class B { protected: int X; } - // class D : public B { void f(); } - // void D::f() { this->^; } - // The completion after "this->" will have `InBaseClass` set to true and - // `Ctx` set to "B", when looking up in `B`. We need to set the actual - // accessing context (i.e. naming class) to "D" so that access can be - // calculated correctly. - if (InBaseClass && isa<CXXRecordDecl>(Ctx)) { - CXXRecordDecl *RC = nullptr; - // Get the enclosing record. - for (DeclContext *DC = CurContext; !DC->isFileContext(); - DC = DC->getParent()) { - if ((RC = dyn_cast<CXXRecordDecl>(DC))) - break; - } - if (RC) - AccessingCtx = RC; - } - Accessible = Results.getSema().IsSimplyAccessible(ND, AccessingCtx); - } - + if (Ctx) + Accessible = Results.getSema().IsSimplyAccessible(ND, Ctx); ResultBuilder::Result Result(ND, Results.getBasePriority(ND), nullptr, false, Accessible, FixIts); Results.AddResult(Result, CurContext, Hiding, InBaseClass); |
