diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-09 02:06:17 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-09 02:06:17 +0000 |
commit | 8d267c57afb3af418ed5281b7a9bb4555d701a82 (patch) | |
tree | d38cfe3af21da70e2686d0bc251f6b0925ca0960 /lib/AST/DeclPrinter.cpp | |
parent | f81e5a9e3f3ff80c56e4afb4fe6311a8735f36e8 (diff) |
Modules: introduce the __module_private__ declaration specifier, which
indicates that a declaration is only visible within the module it is
declared in.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139348 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclPrinter.cpp')
-rw-r--r-- | lib/AST/DeclPrinter.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp index 3a95d1342f..5f9c1910e2 100644 --- a/lib/AST/DeclPrinter.cpp +++ b/lib/AST/DeclPrinter.cpp @@ -313,8 +313,12 @@ void DeclPrinter::VisitTranslationUnitDecl(TranslationUnitDecl *D) { void DeclPrinter::VisitTypedefDecl(TypedefDecl *D) { std::string S = D->getNameAsString(); D->getUnderlyingType().getAsStringInternal(S, Policy); - if (!Policy.SuppressSpecifiers) + if (!Policy.SuppressSpecifiers) { Out << "typedef "; + + if (D->isModulePrivate()) + Out << "__module_private__ "; + } Out << S; } @@ -324,6 +328,8 @@ void DeclPrinter::VisitTypeAliasDecl(TypeAliasDecl *D) { } void DeclPrinter::VisitEnumDecl(EnumDecl *D) { + if (!Policy.SuppressSpecifiers && D->isModulePrivate()) + Out << "__module_private__ "; Out << "enum "; if (D->isScoped()) { if (D->isScopedUsingClassTag()) @@ -347,6 +353,8 @@ void DeclPrinter::VisitEnumDecl(EnumDecl *D) { } void DeclPrinter::VisitRecordDecl(RecordDecl *D) { + if (!Policy.SuppressSpecifiers && D->isModulePrivate()) + Out << "__module_private__ "; Out << D->getKindName(); if (D->getIdentifier()) Out << ' ' << D; @@ -376,8 +384,9 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { case SC_Auto: case SC_Register: llvm_unreachable("invalid for functions"); } - if (D->isInlineSpecified()) Out << "inline "; + if (D->isInlineSpecified()) Out << "inline "; if (D->isVirtualAsWritten()) Out << "virtual "; + if (D->isModulePrivate()) Out << "__module_private__ "; } PrintingPolicy SubPolicy(Policy); @@ -558,6 +567,8 @@ void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) { void DeclPrinter::VisitFieldDecl(FieldDecl *D) { if (!Policy.SuppressSpecifiers && D->isMutable()) Out << "mutable "; + if (!Policy.SuppressSpecifiers && D->isModulePrivate()) + Out << "__module_private__ "; std::string Name = D->getNameAsString(); D->getType().getAsStringInternal(Name, Policy); @@ -586,6 +597,8 @@ void DeclPrinter::VisitVarDecl(VarDecl *D) { if (!Policy.SuppressSpecifiers && D->isThreadSpecified()) Out << "__thread "; + if (!Policy.SuppressSpecifiers && D->isModulePrivate()) + Out << "__module_private__ "; std::string Name = D->getNameAsString(); QualType T = D->getType(); @@ -650,6 +663,8 @@ void DeclPrinter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) { } void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) { + if (!Policy.SuppressSpecifiers && D->isModulePrivate()) + Out << "__module_private__ "; Out << D->getKindName(); if (D->getIdentifier()) Out << ' ' << D; |