diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-12-01 17:11:21 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-12-01 17:11:21 +0000 |
commit | 5e35693721364673f8196e4f5a370f56b92e6053 (patch) | |
tree | 7de6955b4b607db6fb559ced4e3c710c2318ef75 /include/clang/Basic/Module.h | |
parent | ee5a21fda5efce750c21db5a1d635c9742f5859b (diff) |
Introduce the notion of name visibility into modules. For a given
(sub)module, all of the names may be hidden, just the macro names may
be exposed (for example, after the preprocessor has seen the import of
the module but the parser has not), or all of the names may be
exposed. Importing a module makes its names, and the names in any of
its non-explicit submodules, visible to name lookup (transitively).
This commit only introduces the notion of name visible and marks
modules and submodules as visible when they are imported. The actual
name-hiding logic in the AST reader will follow (along with test cases).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@145586 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/Module.h')
-rw-r--r-- | include/clang/Basic/Module.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/include/clang/Basic/Module.h b/include/clang/Basic/Module.h index 4f5280738f..4eaa1be291 100644 --- a/include/clang/Basic/Module.h +++ b/include/clang/Basic/Module.h @@ -58,17 +58,33 @@ public: /// \brief Whether this is an explicit submodule. bool IsExplicit; + /// \brief Describes the visibility of the various names within a + /// particular module. + enum NameVisibilityKind { + /// \brief All of the names in this module are hidden. + /// + Hidden, + /// \brief Only the macro names in this module are visible. + MacrosVisible, + /// \brief All of the names in this module are visible. + AllVisible + }; + + ///\ brief The visibility of names within this particular module. + NameVisibilityKind NameVisibility; + /// \brief Construct a top-level module. explicit Module(StringRef Name, SourceLocation DefinitionLoc, bool IsFramework) : Name(Name), DefinitionLoc(DefinitionLoc), Parent(0), UmbrellaHeader(0), - IsFramework(IsFramework), IsExplicit(false) { } + IsFramework(IsFramework), IsExplicit(false), NameVisibility(Hidden) { } /// \brief Construct a new module or submodule. Module(StringRef Name, SourceLocation DefinitionLoc, Module *Parent, bool IsFramework, bool IsExplicit) : Name(Name), DefinitionLoc(DefinitionLoc), Parent(Parent), - UmbrellaHeader(0), IsFramework(IsFramework), IsExplicit(IsExplicit) { } + UmbrellaHeader(0), IsFramework(IsFramework), IsExplicit(IsExplicit), + NameVisibility(Hidden) { } ~Module(); |