aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/Mangle.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/Mangle.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/Mangle.cpp')
-rw-r--r--lib/AST/Mangle.cpp35
1 files changed, 19 insertions, 16 deletions
diff --git a/lib/AST/Mangle.cpp b/lib/AST/Mangle.cpp
index 83d9ed6678..51d4be340f 100644
--- a/lib/AST/Mangle.cpp
+++ b/lib/AST/Mangle.cpp
@@ -39,8 +39,7 @@ namespace {
static void mangleFunctionBlock(MangleContext &Context,
llvm::StringRef Outer,
const BlockDecl *BD,
- llvm::SmallVectorImpl<char> &Res) {
- llvm::raw_svector_ostream Out(Res);
+ llvm::raw_svector_ostream &Out) {
Out << "__" << Outer << "_block_invoke_" << Context.getBlockId(BD, true);
}
@@ -56,31 +55,34 @@ static void checkMangleDC(const DeclContext *DC, const BlockDecl *BD) {
}
void MangleContext::mangleGlobalBlock(const BlockDecl *BD,
- llvm::SmallVectorImpl<char> &Res) {
- llvm::raw_svector_ostream Out(Res);
+ llvm::raw_svector_ostream &Out) {
Out << "__block_global_" << getBlockId(BD, false);
}
void MangleContext::mangleCtorBlock(const CXXConstructorDecl *CD,
CXXCtorType CT, const BlockDecl *BD,
- llvm::SmallVectorImpl<char> &Res) {
+ llvm::raw_svector_ostream &ResStream) {
checkMangleDC(CD, BD);
llvm::SmallString<64> Buffer;
- mangleCXXCtor(CD, CT, Buffer);
- mangleFunctionBlock(*this, Buffer, BD, Res);
+ llvm::raw_svector_ostream Out(Buffer);
+ mangleCXXCtor(CD, CT, Out);
+ Out.flush();
+ mangleFunctionBlock(*this, Buffer, BD, ResStream);
}
void MangleContext::mangleDtorBlock(const CXXDestructorDecl *DD,
CXXDtorType DT, const BlockDecl *BD,
- llvm::SmallVectorImpl<char> &Res) {
+ llvm::raw_svector_ostream &ResStream) {
checkMangleDC(DD, BD);
llvm::SmallString<64> Buffer;
- mangleCXXDtor(DD, DT, Buffer);
- mangleFunctionBlock(*this, Buffer, BD, Res);
+ llvm::raw_svector_ostream Out(Buffer);
+ mangleCXXDtor(DD, DT, Out);
+ Out.flush();
+ mangleFunctionBlock(*this, Buffer, BD, ResStream);
}
void MangleContext::mangleBlock(const DeclContext *DC, const BlockDecl *BD,
- llvm::SmallVectorImpl<char> &Res) {
+ llvm::raw_svector_ostream &Out) {
assert(!isa<CXXConstructorDecl>(DC) && !isa<CXXDestructorDecl>(DC));
checkMangleDC(DC, BD);
@@ -97,11 +99,12 @@ void MangleContext::mangleBlock(const DeclContext *DC, const BlockDecl *BD,
// Itanium C++ ABI object. What should we do now? Right now, I'm just
// calling the mangleName() method on the MangleContext; is there a
// better way?
- mangleName(ND, Buffer);
+ llvm::raw_svector_ostream Out(Buffer);
+ mangleName(ND, Out);
}
}
- mangleFunctionBlock(*this, Buffer, BD, Res);
+ mangleFunctionBlock(*this, Buffer, BD, Out);
}
void MangleContext::mangleObjCMethodName(const ObjCMethodDecl *MD,
@@ -121,12 +124,12 @@ void MangleContext::mangleObjCMethodName(const ObjCMethodDecl *MD,
}
void MangleContext::mangleBlock(const BlockDecl *BD,
- llvm::SmallVectorImpl<char> &Res) {
+ llvm::raw_svector_ostream &Out) {
const DeclContext *DC = BD->getDeclContext();
while (isa<BlockDecl>(DC) || isa<EnumDecl>(DC))
DC = DC->getParent();
if (DC->isFunctionOrMethod())
- mangleBlock(DC, BD, Res);
+ mangleBlock(DC, BD, Out);
else
- mangleGlobalBlock(BD, Res);
+ mangleGlobalBlock(BD, Out);
}