aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/MicrosoftMangle.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2011-02-10 23:59:36 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2011-02-10 23:59:36 +0000
commitc4850c2aa4c281a352e228aafc51fb1e30dcad02 (patch)
tree74525de14e4a77664fb1c3842918b6e08912129a /lib/AST/MicrosoftMangle.cpp
parent242302673bdcf35b49579a30fed9dc068a4e10f2 (diff)
Use raw_svector_ostream in more places in the mangler.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125321 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/MicrosoftMangle.cpp')
-rw-r--r--lib/AST/MicrosoftMangle.cpp25
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp
index a8f9ed2569..a2300eef23 100644
--- a/lib/AST/MicrosoftMangle.cpp
+++ b/lib/AST/MicrosoftMangle.cpp
@@ -29,13 +29,13 @@ namespace {
/// Microsoft Visual C++ ABI.
class MicrosoftCXXNameMangler {
MangleContext &Context;
- llvm::raw_svector_ostream Out;
+ llvm::raw_svector_ostream &Out;
ASTContext &getASTContext() const { return Context.getASTContext(); }
public:
- MicrosoftCXXNameMangler(MangleContext &C, llvm::SmallVectorImpl<char> &Res)
- : Context(C), Out(Res) { }
+ MicrosoftCXXNameMangler(MangleContext &C, llvm::raw_svector_ostream &Out_)
+ : Context(C), Out(Out_) { }
void mangle(const NamedDecl *D, llvm::StringRef Prefix = "?");
void mangleName(const NamedDecl *ND);
@@ -80,7 +80,7 @@ public:
MicrosoftMangleContext(ASTContext &Context,
Diagnostic &Diags) : MangleContext(Context, Diags) { }
virtual bool shouldMangleDeclName(const NamedDecl *D);
- virtual void mangleName(const NamedDecl *D, llvm::SmallVectorImpl<char> &);
+ virtual void mangleName(const NamedDecl *D, llvm::raw_svector_ostream &Out);
virtual void mangleThunk(const CXXMethodDecl *MD,
const ThunkInfo &Thunk,
llvm::SmallVectorImpl<char> &);
@@ -97,9 +97,9 @@ public:
virtual void mangleCXXRTTI(QualType T, llvm::SmallVectorImpl<char> &);
virtual void mangleCXXRTTIName(QualType T, llvm::SmallVectorImpl<char> &);
virtual void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type,
- llvm::SmallVectorImpl<char> &);
+ llvm::raw_svector_ostream &);
virtual void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type,
- llvm::SmallVectorImpl<char> &);
+ llvm::raw_svector_ostream &);
virtual void mangleReferenceTemporary(const clang::VarDecl *,
llvm::SmallVectorImpl<char> &);
};
@@ -380,9 +380,8 @@ void MicrosoftCXXNameMangler::manglePostfix(const DeclContext *DC,
return;
if (const BlockDecl *BD = dyn_cast<BlockDecl>(DC)) {
- llvm::SmallString<64> Name;
- Context.mangleBlock(BD, Name);
- Out << Name << '@';
+ Context.mangleBlock(BD, Out);
+ Out << '@';
return manglePostfix(DC->getParent(), NoFunction);
}
@@ -1123,7 +1122,7 @@ void MicrosoftCXXNameMangler::mangleType(const DecltypeType *T) {
}
void MicrosoftMangleContext::mangleName(const NamedDecl *D,
- llvm::SmallVectorImpl<char> &Name) {
+ llvm::raw_svector_ostream &Out) {
assert((isa<FunctionDecl>(D) || isa<VarDecl>(D)) &&
"Invalid mangleName() call, argument is not a variable or function!");
assert(!isa<CXXConstructorDecl>(D) && !isa<CXXDestructorDecl>(D) &&
@@ -1133,7 +1132,7 @@ void MicrosoftMangleContext::mangleName(const NamedDecl *D,
getASTContext().getSourceManager(),
"Mangling declaration");
- MicrosoftCXXNameMangler Mangler(*this, Name);
+ MicrosoftCXXNameMangler Mangler(*this, Out);
return Mangler.mangle(D);
}
void MicrosoftMangleContext::mangleThunk(const CXXMethodDecl *MD,
@@ -1171,12 +1170,12 @@ void MicrosoftMangleContext::mangleCXXRTTIName(QualType T,
}
void MicrosoftMangleContext::mangleCXXCtor(const CXXConstructorDecl *D,
CXXCtorType Type,
- llvm::SmallVectorImpl<char> &) {
+ llvm::raw_svector_ostream &) {
assert(false && "Can't yet mangle constructors!");
}
void MicrosoftMangleContext::mangleCXXDtor(const CXXDestructorDecl *D,
CXXDtorType Type,
- llvm::SmallVectorImpl<char> &) {
+ llvm::raw_svector_ostream &) {
assert(false && "Can't yet mangle destructors!");
}
void MicrosoftMangleContext::mangleReferenceTemporary(const clang::VarDecl *,