Skip to content

Commit f182d39

Browse files
committed
[Mangler] Move the body of the 'finalize' methods into the cpp files.
1 parent 1ea703c commit f182d39

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

include/swift/AST/Mangle.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define __SWIFT_AST_MANGLE_H__
1515

1616
#include "llvm/ADT/DenseMap.h"
17+
#include "swift/ABI/Compression.h"
1718
#include "swift/AST/Types.h"
1819
#include "swift/AST/Decl.h"
1920
#include "swift/AST/GenericSignature.h"
@@ -89,19 +90,11 @@ class Mangler {
8990
};
9091

9192
/// Finish the mangling of the symbol and return the mangled name.
92-
std::string finalize() {
93-
assert(Storage.size() && "Mangling an empty name");
94-
std::string result = std::string(Storage.data(), Storage.size());
95-
Storage.clear();
96-
return result;
97-
}
93+
std::string finalize();
9894

9995
/// Finish the mangling of the symbol and write the mangled name into
10096
/// \p stream.
101-
void finalize(llvm::raw_ostream &stream) {
102-
std::string result = finalize();
103-
stream.write(result.data(), result.size());
104-
}
97+
void finalize(llvm::raw_ostream &stream);
10598

10699
void setModuleContext(ModuleDecl *M) { Mod = M; }
107100

lib/AST/Mangle.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,21 @@ static Demangle::OperatorKind TranslateOperator(OperatorFixity fixity) {
7070
llvm_unreachable("invalid operator fixity");
7171
}
7272

73+
/// Finish the mangling of the symbol and return the mangled name.
74+
std::string Mangler::finalize() {
75+
assert(Storage.size() && "Mangling an empty name");
76+
std::string result = std::string(Storage.data(), Storage.size());
77+
Storage.clear();
78+
return result;
79+
}
80+
81+
/// Finish the mangling of the symbol and write the mangled name into
82+
/// \p stream.
83+
void Mangler::finalize(llvm::raw_ostream &stream) {
84+
std::string result = finalize();
85+
stream.write(result.data(), result.size());
86+
}
87+
7388
/// Mangle a StringRef as an identifier into a buffer.
7489
void Mangler::mangleIdentifier(StringRef str, OperatorFixity fixity,
7590
bool isOperator) {

0 commit comments

Comments
 (0)