diff options
Diffstat (limited to 'include/clang/Sema/Lookup.h')
-rw-r--r-- | include/clang/Sema/Lookup.h | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/include/clang/Sema/Lookup.h b/include/clang/Sema/Lookup.h index fe5d262..3e7e3a1 100644 --- a/include/clang/Sema/Lookup.h +++ b/include/clang/Sema/Lookup.h @@ -15,8 +15,8 @@ #ifndef LLVM_CLANG_SEMA_LOOKUP_H #define LLVM_CLANG_SEMA_LOOKUP_H -#include "clang/Sema/Sema.h" #include "clang/AST/DeclCXX.h" +#include "clang/Sema/Sema.h" namespace clang { @@ -138,7 +138,8 @@ public: IDNS(0), Redecl(Redecl != Sema::NotForRedeclaration), HideTags(true), - Diagnose(Redecl == Sema::NotForRedeclaration) + Diagnose(Redecl == Sema::NotForRedeclaration), + AllowHidden(Redecl == Sema::ForRedeclaration) { configure(); } @@ -158,7 +159,8 @@ public: IDNS(0), Redecl(Redecl != Sema::NotForRedeclaration), HideTags(true), - Diagnose(Redecl == Sema::NotForRedeclaration) + Diagnose(Redecl == Sema::NotForRedeclaration), + AllowHidden(Redecl == Sema::ForRedeclaration) { configure(); } @@ -176,7 +178,8 @@ public: IDNS(Other.IDNS), Redecl(Other.Redecl), HideTags(Other.HideTags), - Diagnose(false) + Diagnose(false), + AllowHidden(Other.AllowHidden) {} ~LookupResult() { @@ -214,10 +217,16 @@ public: return Redecl; } + /// \brief Specify whether hidden declarations are visible, e.g., + /// for recovery reasons. + void setAllowHidden(bool AH) { + AllowHidden = AH; + } + /// \brief Determine whether this lookup is permitted to see hidden /// declarations, such as those in modules that have not yet been imported. bool isHiddenDeclarationVisible() const { - return Redecl || LookupKind == Sema::LookupTagName; + return AllowHidden || LookupKind == Sema::LookupTagName; } /// Sets whether tag declarations should be hidden by non-tag @@ -483,6 +492,7 @@ public: /// \brief Change this lookup's redeclaration kind. void setRedeclarationKind(Sema::RedeclarationKind RK) { Redecl = RK; + AllowHidden = (RK == Sema::ForRedeclaration); configure(); } @@ -615,7 +625,7 @@ private: bool sanityCheckUnresolved() const { for (iterator I = begin(), E = end(); I != E; ++I) - if (isa<UnresolvedUsingValueDecl>(*I)) + if (isa<UnresolvedUsingValueDecl>((*I)->getUnderlyingDecl())) return true; return false; } @@ -644,6 +654,9 @@ private: bool HideTags; bool Diagnose; + + /// \brief True if we should allow hidden declarations to be 'visible'. + bool AllowHidden; }; /// \brief Consumes visible declarations found when searching for |