diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-07-21 23:54:07 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-07-21 23:54:07 +0000 |
commit | a4f29fcf3bf9ead1d44953e0f8be59ba26fc8d1f (patch) | |
tree | 4ad794414ef5bf40eefda5980ccd7993188426a0 /include/clang/Sema/Lookup.h | |
parent | 1c737b3071785a83d581de600b7356518faa9598 (diff) |
[modules] In C++, stop serializing and deserializing a list of declarations in
the identifier table. This is redundant, since the TU-scope lookups are also
serialized as part of the TU DeclContext, and wasteful in a number of ways. We
still emit the decls for PCH / preamble builds, since for those we want
identical results, not merely semantically equivalent ones.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242855 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Sema/Lookup.h')
-rw-r--r-- | include/clang/Sema/Lookup.h | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/include/clang/Sema/Lookup.h b/include/clang/Sema/Lookup.h index 5bfee8b0d0..bc9cf4279a 100644 --- a/include/clang/Sema/Lookup.h +++ b/include/clang/Sema/Lookup.h @@ -140,6 +140,7 @@ public: HideTags(true), Diagnose(Redecl == Sema::NotForRedeclaration), AllowHidden(Redecl == Sema::ForRedeclaration), + AllowHiddenInternal(AllowHidden), Shadowed(false) { configure(); @@ -162,6 +163,7 @@ public: HideTags(true), Diagnose(Redecl == Sema::NotForRedeclaration), AllowHidden(Redecl == Sema::ForRedeclaration), + AllowHiddenInternal(AllowHidden), Shadowed(false) { configure(); @@ -182,6 +184,7 @@ public: HideTags(Other.HideTags), Diagnose(false), AllowHidden(Other.AllowHidden), + AllowHiddenInternal(Other.AllowHiddenInternal), Shadowed(false) {} @@ -223,13 +226,20 @@ public: /// \brief Specify whether hidden declarations are visible, e.g., /// for recovery reasons. void setAllowHidden(bool AH) { - AllowHidden = AH; + AllowHiddenInternal = AllowHidden = AH; + } + + /// \brief Specify whether hidden internal declarations are visible. + void setAllowHiddenInternal(bool AHI) { + AllowHiddenInternal = AHI; } /// \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 AllowHidden || LookupKind == Sema::LookupTagName; + bool isHiddenDeclarationVisible(NamedDecl *ND) const { + return (AllowHidden && + (AllowHiddenInternal || ND->isExternallyVisible())) || + LookupKind == Sema::LookupTagName; } /// Sets whether tag declarations should be hidden by non-tag @@ -302,7 +312,7 @@ public: if (!D->isInIdentifierNamespace(IDNS)) return nullptr; - if (isHiddenDeclarationVisible() || isVisible(getSema(), D)) + if (isHiddenDeclarationVisible(D) || isVisible(getSema(), D)) return D; return getAcceptableDeclSlow(D); @@ -511,7 +521,7 @@ public: /// \brief Change this lookup's redeclaration kind. void setRedeclarationKind(Sema::RedeclarationKind RK) { Redecl = RK; - AllowHidden = (RK == Sema::ForRedeclaration); + AllowHiddenInternal = AllowHidden = (RK == Sema::ForRedeclaration); configure(); } @@ -678,6 +688,9 @@ private: /// \brief True if we should allow hidden declarations to be 'visible'. bool AllowHidden; + /// \brief True if we should allow hidden internal declarations to be visible. + bool AllowHiddenInternal; + /// \brief True if the found declarations were shadowed by some other /// declaration that we skipped. This only happens when \c LookupKind /// is \c LookupRedeclarationWithLinkage. |