@@ -50,13 +50,13 @@ bool ClangSyntaxPrinter::isClangKeyword(Identifier name) {
5050 return ClangSyntaxPrinter::isClangKeyword (name.str ());
5151}
5252
53- void ClangSyntaxPrinter::printIdentifier (StringRef name) {
53+ void ClangSyntaxPrinter::printIdentifier (StringRef name) const {
5454 os << name;
5555 if (ClangSyntaxPrinter::isClangKeyword (name))
5656 os << ' _' ;
5757}
5858
59- void ClangSyntaxPrinter::printBaseName (const ValueDecl *decl) {
59+ void ClangSyntaxPrinter::printBaseName (const ValueDecl *decl) const {
6060 assert (decl->getName ().isSimpleName ());
6161 printIdentifier (cxx_translation::getNameForCxx (decl));
6262}
@@ -136,12 +136,23 @@ void ClangSyntaxPrinter::printNominalTypeQualifier(
136136 os << " ::" ;
137137}
138138
139+ void ClangSyntaxPrinter::printModuleNamespaceStart (
140+ const ModuleDecl &moduleContext) const {
141+ os << " namespace " ;
142+ printBaseName (&moduleContext);
143+ os << " __attribute__((swift_private))" ;
144+ os << " {\n " ;
145+ }
146+
139147// / Print a C++ namespace declaration with the give name and body.
140148void ClangSyntaxPrinter::printNamespace (
141149 llvm::function_ref<void (raw_ostream &OS)> namePrinter,
142- llvm::function_ref<void(raw_ostream &OS)> bodyPrinter) const {
150+ llvm::function_ref<void(raw_ostream &OS)> bodyPrinter,
151+ NamespaceTrivia trivia) const {
143152 os << " namespace " ;
144153 namePrinter (os);
154+ if (trivia == NamespaceTrivia::AttributeSwiftPrivate)
155+ os << " __attribute__((swift_private))" ;
145156 os << " {\n\n " ;
146157 bodyPrinter (os);
147158 os << " \n } // namespace " ;
@@ -150,9 +161,9 @@ void ClangSyntaxPrinter::printNamespace(
150161}
151162
152163void ClangSyntaxPrinter::printNamespace (
153- StringRef name,
154- llvm::function_ref< void (raw_ostream &OS)> bodyPrinter ) const {
155- printNamespace ([&](raw_ostream &os) { os << name; }, bodyPrinter);
164+ StringRef name, llvm::function_ref< void (raw_ostream &OS)> bodyPrinter,
165+ NamespaceTrivia trivia ) const {
166+ printNamespace ([&](raw_ostream &os) { os << name; }, bodyPrinter, trivia );
156167}
157168
158169void ClangSyntaxPrinter::printExternC (
0 commit comments