[cfe-commits] r125360 - in /cfe/trunk: include/clang/AST/Mangle.h lib/AST/ItaniumMangle.cpp lib/AST/Mangle.cpp lib/AST/MicrosoftMangle.cpp lib/CodeGen/CGExpr.cpp lib/CodeGen/CGRTTI.cpp lib/CodeGen/CGVTT.cpp lib/CodeGen/CGVTables.cpp lib/CodeGen/CodeGenTBAA.cpp lib/CodeGen/ItaniumCXXABI.cpp

Rafael Espindola rafael.espindola at gmail.com
Thu Feb 10 18:52:17 PST 2011


Author: rafael
Date: Thu Feb 10 20:52:17 2011
New Revision: 125360

URL: http://llvm.org/viewvc/llvm-project?rev=125360&view=rev
Log:
For consistency, use llvm::raw_ostream in the rest of the mangle api.

Modified:
    cfe/trunk/include/clang/AST/Mangle.h
    cfe/trunk/lib/AST/ItaniumMangle.cpp
    cfe/trunk/lib/AST/Mangle.cpp
    cfe/trunk/lib/AST/MicrosoftMangle.cpp
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/lib/CodeGen/CGRTTI.cpp
    cfe/trunk/lib/CodeGen/CGVTT.cpp
    cfe/trunk/lib/CodeGen/CGVTables.cpp
    cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp
    cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp

Modified: cfe/trunk/include/clang/AST/Mangle.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Mangle.h?rev=125360&r1=125359&r2=125360&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Mangle.h (original)
+++ cfe/trunk/include/clang/AST/Mangle.h Thu Feb 10 20:52:17 2011
@@ -98,21 +98,21 @@
   virtual void mangleName(const NamedDecl *D, llvm::raw_ostream &)=0;
   virtual void mangleThunk(const CXXMethodDecl *MD,
                           const ThunkInfo &Thunk,
-                          llvm::SmallVectorImpl<char> &) = 0;
+                          llvm::raw_ostream &) = 0;
   virtual void mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type,
                                   const ThisAdjustment &ThisAdjustment,
-                                  llvm::SmallVectorImpl<char> &) = 0;
+                                  llvm::raw_ostream &) = 0;
   virtual void mangleReferenceTemporary(const VarDecl *D,
-                                        llvm::SmallVectorImpl<char> &) = 0;
+                                        llvm::raw_ostream &) = 0;
   virtual void mangleCXXVTable(const CXXRecordDecl *RD,
-                               llvm::SmallVectorImpl<char> &) = 0;
+                               llvm::raw_ostream &) = 0;
   virtual void mangleCXXVTT(const CXXRecordDecl *RD,
-                            llvm::SmallVectorImpl<char> &) = 0;
+                            llvm::raw_ostream &) = 0;
   virtual void mangleCXXCtorVTable(const CXXRecordDecl *RD, int64_t Offset,
                                    const CXXRecordDecl *Type,
-                                   llvm::SmallVectorImpl<char> &) = 0;
-  virtual void mangleCXXRTTI(QualType T, llvm::SmallVectorImpl<char> &) = 0;
-  virtual void mangleCXXRTTIName(QualType T, llvm::SmallVectorImpl<char> &) = 0;
+                                   llvm::raw_ostream &) = 0;
+  virtual void mangleCXXRTTI(QualType T, llvm::raw_ostream &) = 0;
+  virtual void mangleCXXRTTIName(QualType T, llvm::raw_ostream &) = 0;
   virtual void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type,
                              llvm::raw_ostream &) = 0;
   virtual void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type,
@@ -130,11 +130,11 @@
   void mangleBlock(const BlockDecl *BD, llvm::raw_ostream &Out);
 
   void mangleObjCMethodName(const ObjCMethodDecl *MD,
-                            llvm::SmallVectorImpl<char> &);
+                            llvm::raw_ostream &);
 
   // This is pretty lame.
   virtual void mangleItaniumGuardVariable(const VarDecl *D,
-                                          llvm::SmallVectorImpl<char> &) {
+                                          llvm::raw_ostream &) {
     assert(0 && "Target does not support mangling guard variables");
   }
   /// @}

Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=125360&r1=125359&r2=125360&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Thu Feb 10 20:52:17 2011
@@ -94,28 +94,27 @@
   void mangleName(const NamedDecl *D, llvm::raw_ostream &);
   void mangleThunk(const CXXMethodDecl *MD,
                    const ThunkInfo &Thunk,
-                   llvm::SmallVectorImpl<char> &);
+                   llvm::raw_ostream &);
   void mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type,
                           const ThisAdjustment &ThisAdjustment,
-                          llvm::SmallVectorImpl<char> &);
+                          llvm::raw_ostream &);
   void mangleReferenceTemporary(const VarDecl *D,
-                                llvm::SmallVectorImpl<char> &);
+                                llvm::raw_ostream &);
   void mangleCXXVTable(const CXXRecordDecl *RD,
-                       llvm::SmallVectorImpl<char> &);
+                       llvm::raw_ostream &);
   void mangleCXXVTT(const CXXRecordDecl *RD,
-                    llvm::SmallVectorImpl<char> &);
+                    llvm::raw_ostream &);
   void mangleCXXCtorVTable(const CXXRecordDecl *RD, int64_t Offset,
                            const CXXRecordDecl *Type,
-                           llvm::SmallVectorImpl<char> &);
-  void mangleCXXRTTI(QualType T, llvm::SmallVectorImpl<char> &);
-  void mangleCXXRTTIName(QualType T, llvm::SmallVectorImpl<char> &);
+                           llvm::raw_ostream &);
+  void mangleCXXRTTI(QualType T, llvm::raw_ostream &);
+  void mangleCXXRTTIName(QualType T, llvm::raw_ostream &);
   void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type,
                      llvm::raw_ostream &);
   void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type,
                      llvm::raw_ostream &);
 
-  void mangleItaniumGuardVariable(const VarDecl *D,
-                                  llvm::SmallVectorImpl<char> &);
+  void mangleItaniumGuardVariable(const VarDecl *D, llvm::raw_ostream &);
 
   void mangleInitDiscriminator() {
     Discriminator = 0;
@@ -1188,9 +1187,7 @@
 }
 
 void CXXNameMangler::mangleObjCMethodName(const ObjCMethodDecl *MD) {
-  llvm::SmallString<64> Buffer;
-  Context.mangleObjCMethodName(MD, Buffer);
-  Out << Buffer;
+  Context.mangleObjCMethodName(MD, Out);
 }
 
 void CXXNameMangler::mangleType(QualType nonCanon) {
@@ -2567,7 +2564,7 @@
 
 void ItaniumMangleContext::mangleThunk(const CXXMethodDecl *MD,
                                        const ThunkInfo &Thunk,
-                                       llvm::SmallVectorImpl<char> &Res) {
+                                       llvm::raw_ostream &Out) {
   //  <special-name> ::= T <call-offset> <base encoding>
   //                      # base is the nominal target function of thunk
   //  <special-name> ::= Tc <call-offset> <call-offset> <base encoding>
@@ -2577,7 +2574,6 @@
   
   assert(!isa<CXXDestructorDecl>(MD) &&
          "Use mangleCXXDtor for destructor decls!");
-  llvm::raw_svector_ostream Out(Res);
   CXXNameMangler Mangler(*this, Out);
   Mangler.getStream() << "_ZT";
   if (!Thunk.Return.isEmpty())
@@ -2598,11 +2594,9 @@
 ItaniumMangleContext::mangleCXXDtorThunk(const CXXDestructorDecl *DD,
                                          CXXDtorType Type,
                                          const ThisAdjustment &ThisAdjustment,
-                                         llvm::SmallVectorImpl<char> &Res) {
+                                         llvm::raw_ostream &Out) {
   //  <special-name> ::= T <call-offset> <base encoding>
   //                      # base is the nominal target function of thunk
-  
-  llvm::raw_svector_ostream Out(Res);
   CXXNameMangler Mangler(*this, Out, DD, Type);
   Mangler.getStream() << "_ZT";
 
@@ -2616,38 +2610,34 @@
 /// mangleGuardVariable - Returns the mangled name for a guard variable
 /// for the passed in VarDecl.
 void ItaniumMangleContext::mangleItaniumGuardVariable(const VarDecl *D,
-                                             llvm::SmallVectorImpl<char> &Res) {
+                                                      llvm::raw_ostream &Out) {
   //  <special-name> ::= GV <object name>       # Guard variable for one-time
   //                                            # initialization
-  llvm::raw_svector_ostream Out(Res);
   CXXNameMangler Mangler(*this, Out);
   Mangler.getStream() << "_ZGV";
   Mangler.mangleName(D);
 }
 
 void ItaniumMangleContext::mangleReferenceTemporary(const VarDecl *D,
-                                             llvm::SmallVectorImpl<char> &Res) {
+                                                    llvm::raw_ostream &Out) {
   // We match the GCC mangling here.
   //  <special-name> ::= GR <object name>
-  llvm::raw_svector_ostream Out(Res);
   CXXNameMangler Mangler(*this, Out);
   Mangler.getStream() << "_ZGR";
   Mangler.mangleName(D);
 }
 
 void ItaniumMangleContext::mangleCXXVTable(const CXXRecordDecl *RD,
-                                           llvm::SmallVectorImpl<char> &Res) {
+                                           llvm::raw_ostream &Out) {
   // <special-name> ::= TV <type>  # virtual table
-  llvm::raw_svector_ostream Out(Res);
   CXXNameMangler Mangler(*this, Out);
   Mangler.getStream() << "_ZTV";
   Mangler.mangleNameOrStandardSubstitution(RD);
 }
 
 void ItaniumMangleContext::mangleCXXVTT(const CXXRecordDecl *RD,
-                                        llvm::SmallVectorImpl<char> &Res) {
+                                        llvm::raw_ostream &Out) {
   // <special-name> ::= TT <type>  # VTT structure
-  llvm::raw_svector_ostream Out(Res);
   CXXNameMangler Mangler(*this, Out);
   Mangler.getStream() << "_ZTT";
   Mangler.mangleNameOrStandardSubstitution(RD);
@@ -2656,9 +2646,8 @@
 void ItaniumMangleContext::mangleCXXCtorVTable(const CXXRecordDecl *RD,
                                                int64_t Offset,
                                                const CXXRecordDecl *Type,
-                                             llvm::SmallVectorImpl<char> &Res) {
+                                               llvm::raw_ostream &Out) {
   // <special-name> ::= TC <type> <offset number> _ <base type>
-  llvm::raw_svector_ostream Out(Res);
   CXXNameMangler Mangler(*this, Out);
   Mangler.getStream() << "_ZTC";
   Mangler.mangleNameOrStandardSubstitution(RD);
@@ -2668,19 +2657,17 @@
 }
 
 void ItaniumMangleContext::mangleCXXRTTI(QualType Ty,
-                                         llvm::SmallVectorImpl<char> &Res) {
+                                         llvm::raw_ostream &Out) {
   // <special-name> ::= TI <type>  # typeinfo structure
   assert(!Ty.hasQualifiers() && "RTTI info cannot have top-level qualifiers");
-  llvm::raw_svector_ostream Out(Res);
   CXXNameMangler Mangler(*this, Out);
   Mangler.getStream() << "_ZTI";
   Mangler.mangleType(Ty);
 }
 
 void ItaniumMangleContext::mangleCXXRTTIName(QualType Ty,
-                                             llvm::SmallVectorImpl<char> &Res) {
+                                             llvm::raw_ostream &Out) {
   // <special-name> ::= TS <type>  # typeinfo name (null terminated byte string)
-  llvm::raw_svector_ostream Out(Res);
   CXXNameMangler Mangler(*this, Out);
   Mangler.getStream() << "_ZTS";
   Mangler.mangleType(Ty);

Modified: cfe/trunk/lib/AST/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Mangle.cpp?rev=125360&r1=125359&r2=125360&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Mangle.cpp (original)
+++ cfe/trunk/lib/AST/Mangle.cpp Thu Feb 10 20:52:17 2011
@@ -87,30 +87,30 @@
   checkMangleDC(DC, BD);
 
   llvm::SmallString<64> Buffer;
+  llvm::raw_svector_ostream Stream(Buffer);
   if (const ObjCMethodDecl *Method = dyn_cast<ObjCMethodDecl>(DC)) {
-    mangleObjCMethodName(Method, Buffer);
+    mangleObjCMethodName(Method, Stream);
   } else {
     const NamedDecl *ND = cast<NamedDecl>(DC);
     if (IdentifierInfo *II = ND->getIdentifier())
-      Buffer = II->getName();
+      Stream << II->getName();
     else {
       // FIXME: We were doing a mangleUnqualifiedName() before, but that's
       // a private member of a class that will soon itself be private to the
       // 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?
-      llvm::raw_svector_ostream Out(Buffer);
-      mangleName(ND, Out);
+      mangleName(ND, Stream);
     }
   }
-
+  Stream.flush();
   mangleFunctionBlock(*this, Buffer, BD, Out);
 }
 
 void MangleContext::mangleObjCMethodName(const ObjCMethodDecl *MD,
-                                         llvm::SmallVectorImpl<char> &Res) {
+                                         llvm::raw_ostream &Out) {
   llvm::SmallString<64> Name;
-  llvm::raw_svector_ostream OS(Name), Out(Res);
+  llvm::raw_svector_ostream OS(Name);
   
   const ObjCContainerDecl *CD =
   dyn_cast<ObjCContainerDecl>(MD->getDeclContext());

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=125360&r1=125359&r2=125360&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Thu Feb 10 20:52:17 2011
@@ -83,25 +83,25 @@
   virtual void mangleName(const NamedDecl *D, llvm::raw_ostream &Out);
   virtual void mangleThunk(const CXXMethodDecl *MD,
                            const ThunkInfo &Thunk,
-                           llvm::SmallVectorImpl<char> &);
+                           llvm::raw_ostream &);
   virtual void mangleCXXDtorThunk(const CXXDestructorDecl *DD, CXXDtorType Type,
                                   const ThisAdjustment &ThisAdjustment,
-                                  llvm::SmallVectorImpl<char> &);
+                                  llvm::raw_ostream &);
   virtual void mangleCXXVTable(const CXXRecordDecl *RD,
-                               llvm::SmallVectorImpl<char> &);
+                               llvm::raw_ostream &);
   virtual void mangleCXXVTT(const CXXRecordDecl *RD,
-                            llvm::SmallVectorImpl<char> &);
+                            llvm::raw_ostream &);
   virtual void mangleCXXCtorVTable(const CXXRecordDecl *RD, int64_t Offset,
                                    const CXXRecordDecl *Type,
-                                   llvm::SmallVectorImpl<char> &);
-  virtual void mangleCXXRTTI(QualType T, llvm::SmallVectorImpl<char> &);
-  virtual void mangleCXXRTTIName(QualType T, llvm::SmallVectorImpl<char> &);
+                                   llvm::raw_ostream &);
+  virtual void mangleCXXRTTI(QualType T, llvm::raw_ostream &);
+  virtual void mangleCXXRTTIName(QualType T, llvm::raw_ostream &);
   virtual void mangleCXXCtor(const CXXConstructorDecl *D, CXXCtorType Type,
                              llvm::raw_ostream &);
   virtual void mangleCXXDtor(const CXXDestructorDecl *D, CXXDtorType Type,
                              llvm::raw_ostream &);
   virtual void mangleReferenceTemporary(const clang::VarDecl *,
-                                        llvm::SmallVectorImpl<char> &);
+                                        llvm::raw_ostream &);
 };
 
 }
@@ -529,9 +529,7 @@
 }
 
 void MicrosoftCXXNameMangler::mangleObjCMethodName(const ObjCMethodDecl *MD) {
-  llvm::SmallString<64> Buffer;
-  Context.mangleObjCMethodName(MD, Buffer);
-  Out << Buffer;
+  Context.mangleObjCMethodName(MD, Out);
 }
 
 void MicrosoftCXXNameMangler::mangleQualifiers(Qualifiers Quals,
@@ -1137,35 +1135,35 @@
 }
 void MicrosoftMangleContext::mangleThunk(const CXXMethodDecl *MD,
                                          const ThunkInfo &Thunk,
-                                         llvm::SmallVectorImpl<char> &) {
+                                         llvm::raw_ostream &) {
   assert(false && "Can't yet mangle thunks!");
 }
 void MicrosoftMangleContext::mangleCXXDtorThunk(const CXXDestructorDecl *DD,
                                                 CXXDtorType Type,
                                                 const ThisAdjustment &,
-                                                llvm::SmallVectorImpl<char> &) {
+                                                llvm::raw_ostream &) {
   assert(false && "Can't yet mangle destructor thunks!");
 }
 void MicrosoftMangleContext::mangleCXXVTable(const CXXRecordDecl *RD,
-                                             llvm::SmallVectorImpl<char> &) {
+                                             llvm::raw_ostream &) {
   assert(false && "Can't yet mangle virtual tables!");
 }
 void MicrosoftMangleContext::mangleCXXVTT(const CXXRecordDecl *RD,
-                                          llvm::SmallVectorImpl<char> &) {
+                                          llvm::raw_ostream &) {
   llvm_unreachable("The MS C++ ABI does not have virtual table tables!");
 }
 void MicrosoftMangleContext::mangleCXXCtorVTable(const CXXRecordDecl *RD,
                                                  int64_t Offset,
                                                  const CXXRecordDecl *Type,
-                                                 llvm::SmallVectorImpl<char> &) {
+                                                 llvm::raw_ostream &) {
   llvm_unreachable("The MS C++ ABI does not have constructor vtables!");
 }
 void MicrosoftMangleContext::mangleCXXRTTI(QualType T,
-                                           llvm::SmallVectorImpl<char> &) {
+                                           llvm::raw_ostream &) {
   assert(false && "Can't yet mangle RTTI!");
 }
 void MicrosoftMangleContext::mangleCXXRTTIName(QualType T,
-                                               llvm::SmallVectorImpl<char> &) {
+                                               llvm::raw_ostream &) {
   assert(false && "Can't yet mangle RTTI names!");
 }
 void MicrosoftMangleContext::mangleCXXCtor(const CXXConstructorDecl *D,
@@ -1179,7 +1177,7 @@
   assert(false && "Can't yet mangle destructors!");
 }
 void MicrosoftMangleContext::mangleReferenceTemporary(const clang::VarDecl *,
-                                                llvm::SmallVectorImpl<char> &) {
+                                                      llvm::raw_ostream &) {
   assert(false && "Can't yet mangle reference temporaries!");
 }
 

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=125360&r1=125359&r2=125360&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Thu Feb 10 20:52:17 2011
@@ -178,8 +178,10 @@
   if (const VarDecl *VD = dyn_cast_or_null<VarDecl>(InitializedDecl)) {
     if (VD->hasGlobalStorage()) {
       llvm::SmallString<256> Name;
-      CGF.CGM.getCXXABI().getMangleContext().mangleReferenceTemporary(VD, Name);
-      
+      llvm::raw_svector_ostream Out(Name);
+      CGF.CGM.getCXXABI().getMangleContext().mangleReferenceTemporary(VD, Out);
+      Out.flush();
+
       const llvm::Type *RefTempTy = CGF.ConvertTypeForMem(Type);
   
       // Create the reference temporary.

Modified: cfe/trunk/lib/CodeGen/CGRTTI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGRTTI.cpp?rev=125360&r1=125359&r2=125360&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGRTTI.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGRTTI.cpp Thu Feb 10 20:52:17 2011
@@ -116,7 +116,9 @@
 RTTIBuilder::GetAddrOfTypeName(QualType Ty, 
                                llvm::GlobalVariable::LinkageTypes Linkage) {
   llvm::SmallString<256> OutName;
-  CGM.getCXXABI().getMangleContext().mangleCXXRTTIName(Ty, OutName);
+  llvm::raw_svector_ostream Out(OutName);
+  CGM.getCXXABI().getMangleContext().mangleCXXRTTIName(Ty, Out);
+  Out.flush();
   llvm::StringRef Name = OutName.str();
 
   // We know that the mangled name of the type starts at index 4 of the
@@ -135,7 +137,9 @@
 llvm::Constant *RTTIBuilder::GetAddrOfExternalRTTIDescriptor(QualType Ty) {
   // Mangle the RTTI name.
   llvm::SmallString<256> OutName;
-  CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty, OutName);
+  llvm::raw_svector_ostream Out(OutName);
+  CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty, Out);
+  Out.flush();
   llvm::StringRef Name = OutName.str();
 
   // Look for an existing global.
@@ -524,7 +528,9 @@
 
   // Get the typename global.
   llvm::SmallString<256> OutName;
-  CGM.getCXXABI().getMangleContext().mangleCXXRTTIName(Ty, OutName);
+  llvm::raw_svector_ostream Out(OutName);
+  CGM.getCXXABI().getMangleContext().mangleCXXRTTIName(Ty, Out);
+  Out.flush();
   llvm::StringRef Name = OutName.str();
 
   llvm::GlobalVariable *TypeNameGV = CGM.getModule().getNamedGlobal(Name);
@@ -542,7 +548,9 @@
 
   // Check if we've already emitted an RTTI descriptor for this type.
   llvm::SmallString<256> OutName;
-  CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty, OutName);
+  llvm::raw_svector_ostream Out(OutName);
+  CGM.getCXXABI().getMangleContext().mangleCXXRTTI(Ty, Out);
+  Out.flush();
   llvm::StringRef Name = OutName.str();
 
   llvm::GlobalVariable *OldGV = CGM.getModule().getNamedGlobal(Name);

Modified: cfe/trunk/lib/CodeGen/CGVTT.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTT.cpp?rev=125360&r1=125359&r2=125360&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTT.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTT.cpp Thu Feb 10 20:52:17 2011
@@ -393,7 +393,9 @@
   assert(RD->getNumVBases() && "Only classes with virtual bases need a VTT");
 
   llvm::SmallString<256> OutName;
-  CGM.getCXXABI().getMangleContext().mangleCXXVTT(RD, OutName);
+  llvm::raw_svector_ostream Out(OutName);
+  CGM.getCXXABI().getMangleContext().mangleCXXVTT(RD, Out);
+  Out.flush();
   llvm::StringRef Name = OutName.str();
 
   VTTBuilder Builder(CGM, RD, /*GenerateDefinition=*/false);

Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=125360&r1=125359&r2=125360&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Thu Feb 10 20:52:17 2011
@@ -2456,12 +2456,14 @@
 
   // Compute the mangled name.
   llvm::SmallString<256> Name;
+  llvm::raw_svector_ostream Out(Name);
   if (const CXXDestructorDecl* DD = dyn_cast<CXXDestructorDecl>(MD))
     getCXXABI().getMangleContext().mangleCXXDtorThunk(DD, GD.getDtorType(),
-                                                      Thunk.This, Name);
+                                                      Thunk.This, Out);
   else
-    getCXXABI().getMangleContext().mangleThunk(MD, Thunk, Name);
-  
+    getCXXABI().getMangleContext().mangleThunk(MD, Thunk, Out);
+  Out.flush();
+
   const llvm::Type *Ty = getTypes().GetFunctionTypeForVTable(GD);
   return GetOrCreateLLVMFunction(Name, Ty, GD, /*ForVTable=*/true);
 }
@@ -2975,7 +2977,9 @@
 
 llvm::GlobalVariable *CodeGenVTables::GetAddrOfVTable(const CXXRecordDecl *RD) {
   llvm::SmallString<256> OutName;
-  CGM.getCXXABI().getMangleContext().mangleCXXVTable(RD, OutName);
+  llvm::raw_svector_ostream Out(OutName);
+  CGM.getCXXABI().getMangleContext().mangleCXXVTable(RD, Out);
+  Out.flush();
   llvm::StringRef Name = OutName.str();
 
   ComputeVTableRelatedInformation(RD, true);
@@ -3038,8 +3042,10 @@
 
   // Get the mangled construction vtable name.
   llvm::SmallString<256> OutName;
+  llvm::raw_svector_ostream Out(OutName);
   CGM.getCXXABI().getMangleContext().
-    mangleCXXCtorVTable(RD, Base.getBaseOffset() / 8, Base.getBase(), OutName);
+    mangleCXXCtorVTable(RD, Base.getBaseOffset() / 8, Base.getBase(), Out);
+  Out.flush();
   llvm::StringRef Name = OutName.str();
 
   const llvm::Type *Int8PtrTy = llvm::Type::getInt8PtrTy(CGM.getLLVMContext());

Modified: cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp?rev=125360&r1=125359&r2=125360&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenTBAA.cpp Thu Feb 10 20:52:17 2011
@@ -169,7 +169,9 @@
     // TODO: This is using the RTTI name. Is there a better way to get
     // a unique string for a type?
     llvm::SmallString<256> OutName;
-    MContext.mangleCXXRTTIName(QualType(ETy, 0), OutName);
+    llvm::raw_svector_ostream Out(OutName);
+    MContext.mangleCXXRTTIName(QualType(ETy, 0), Out);
+    Out.flush();
     return MetadataCache[Ty] = getTBAAInfoForNamedType(OutName, getChar());
   }
 

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=125360&r1=125359&r2=125360&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Thu Feb 10 20:52:17 2011
@@ -1072,7 +1072,9 @@
 
   // Create the guard variable.
   llvm::SmallString<256> GuardVName;
-  getMangleContext().mangleItaniumGuardVariable(&D, GuardVName);
+  llvm::raw_svector_ostream Out(GuardVName);
+  getMangleContext().mangleItaniumGuardVariable(&D, Out);
+  Out.flush();
 
   // Just absorb linkage and visibility from the variable.
   llvm::GlobalVariable *GuardVariable =





More information about the cfe-commits mailing list