From: Eugene Leviant Date: Wed, 18 Nov 2015 12:48:05 +0000 (+0000) Subject: Set flag for lldb when qualified name lookup is being done X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9bb501e3806eb2ca56b1050f0fcb7d4f319de25b;p=clang Set flag for lldb when qualified name lookup is being done git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253456 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclBase.h b/include/clang/AST/DeclBase.h index f563a04d06..6a4ab2a584 100644 --- a/include/clang/AST/DeclBase.h +++ b/include/clang/AST/DeclBase.h @@ -1142,6 +1142,11 @@ class DeclContext { /// that are missing from the lookup table. mutable bool HasLazyExternalLexicalLookups : 1; + /// \brief If \c true, lookups should only return identifier from + /// DeclContext scope (for example TranslationUnit). Used in + /// LookupQualifiedName() + mutable bool UseQualifiedLookup : 1; + /// \brief Pointer to the data structure used to lookup declarations /// within this context (or a DependentStoredDeclsMap if this is a /// dependent context). We maintain the invariant that, if the map @@ -1176,6 +1181,7 @@ protected: ExternalVisibleStorage(false), NeedToReconcileExternalVisibleStorage(false), HasLazyLocalLexicalLookups(false), HasLazyExternalLexicalLookups(false), + UseQualifiedLookup(false), LookupPtr(nullptr), FirstDecl(nullptr), LastDecl(nullptr) {} public: @@ -1756,6 +1762,16 @@ public: D == LastDecl); } + bool setUseQualifiedLookup(bool use = true) { + bool old_value = UseQualifiedLookup; + UseQualifiedLookup = use; + return old_value; + } + + bool shouldUseQualifiedLookup() const { + return UseQualifiedLookup; + } + static bool classof(const Decl *D); static bool classof(const DeclContext *D) { return true; } diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 245c5519b2..3f36caa84b 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -1907,7 +1907,18 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx, cast(LookupCtx)->isBeingDefined()) && "Declaration context must already be complete!"); - // Perform qualified name lookup into the LookupCtx. + struct QualifiedLookupInScope { + bool oldVal; + DeclContext *Context; + // Set flag in DeclContext informing debugger that we're looking for qualified name + QualifiedLookupInScope(DeclContext *ctx) : Context(ctx) { + oldVal = ctx->setUseQualifiedLookup(); + } + ~QualifiedLookupInScope() { + Context->setUseQualifiedLookup(oldVal); + } + } QL(LookupCtx); + if (LookupDirect(*this, R, LookupCtx)) { R.resolveKind(); if (isa(LookupCtx))