diff options
author | Eugene Leviant <evgeny.leviant@gmail.com> | 2015-11-18 12:48:05 +0000 |
---|---|---|
committer | Eugene Leviant <evgeny.leviant@gmail.com> | 2015-11-18 12:48:05 +0000 |
commit | 0d8103e975536ce1cca79e2521e7fce2f3935359 (patch) | |
tree | 22803f10ade68ae82df6f23363052eac162449b5 /clang | |
parent | 68aa90a11e29b77ccbccc7ae128d342bc8920b40 (diff) | |
download | bcm5719-llvm-0d8103e975536ce1cca79e2521e7fce2f3935359.tar.gz bcm5719-llvm-0d8103e975536ce1cca79e2521e7fce2f3935359.zip |
Set flag for lldb when qualified name lookup is being done
llvm-svn: 253456
Diffstat (limited to 'clang')
-rw-r--r-- | clang/include/clang/AST/DeclBase.h | 16 | ||||
-rw-r--r-- | clang/lib/Sema/SemaLookup.cpp | 13 |
2 files changed, 28 insertions, 1 deletions
diff --git a/clang/include/clang/AST/DeclBase.h b/clang/include/clang/AST/DeclBase.h index f563a04d06d..6a4ab2a5849 100644 --- a/clang/include/clang/AST/DeclBase.h +++ b/clang/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/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index 245c5519b22..3f36caa84bb 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -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)) |