Skip to content

Commit

Permalink
Set flag for lldb when qualified name lookup is being done
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@253456 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
eleviant777 committed Nov 18, 2015
1 parent 34886cc commit 9bb501e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
16 changes: 16 additions & 0 deletions include/clang/AST/DeclBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1176,6 +1181,7 @@ class DeclContext {
ExternalVisibleStorage(false),
NeedToReconcileExternalVisibleStorage(false),
HasLazyLocalLexicalLookups(false), HasLazyExternalLexicalLookups(false),
UseQualifiedLookup(false),
LookupPtr(nullptr), FirstDecl(nullptr), LastDecl(nullptr) {}

public:
Expand Down Expand Up @@ -1756,6 +1762,16 @@ class DeclContext {
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; }

Expand Down
13 changes: 12 additions & 1 deletion lib/Sema/SemaLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1907,7 +1907,18 @@ bool Sema::LookupQualifiedName(LookupResult &R, DeclContext *LookupCtx,
cast<TagDecl>(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<CXXRecordDecl>(LookupCtx))
Expand Down

0 comments on commit 9bb501e

Please sign in to comment.