@@ -50,13 +50,13 @@ bool ClangSyntaxPrinter::isClangKeyword(Identifier name) {
50
50
return ClangSyntaxPrinter::isClangKeyword (name.str ());
51
51
}
52
52
53
- void ClangSyntaxPrinter::printIdentifier (StringRef name) {
53
+ void ClangSyntaxPrinter::printIdentifier (StringRef name) const {
54
54
os << name;
55
55
if (ClangSyntaxPrinter::isClangKeyword (name))
56
56
os << ' _' ;
57
57
}
58
58
59
- void ClangSyntaxPrinter::printBaseName (const ValueDecl *decl) {
59
+ void ClangSyntaxPrinter::printBaseName (const ValueDecl *decl) const {
60
60
assert (decl->getName ().isSimpleName ());
61
61
printIdentifier (cxx_translation::getNameForCxx (decl));
62
62
}
@@ -136,12 +136,23 @@ void ClangSyntaxPrinter::printNominalTypeQualifier(
136
136
os << " ::" ;
137
137
}
138
138
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
+
139
147
// / Print a C++ namespace declaration with the give name and body.
140
148
void ClangSyntaxPrinter::printNamespace (
141
149
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 {
143
152
os << " namespace " ;
144
153
namePrinter (os);
154
+ if (trivia == NamespaceTrivia::AttributeSwiftPrivate)
155
+ os << " __attribute__((swift_private))" ;
145
156
os << " {\n\n " ;
146
157
bodyPrinter (os);
147
158
os << " \n } // namespace " ;
@@ -150,9 +161,9 @@ void ClangSyntaxPrinter::printNamespace(
150
161
}
151
162
152
163
void 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 );
156
167
}
157
168
158
169
void ClangSyntaxPrinter::printExternC (
0 commit comments