diff options
| author | Alp Toker <alp@nuanti.com> | 2014-06-03 02:13:57 +0000 |
|---|---|---|
| committer | Alp Toker <alp@nuanti.com> | 2014-06-03 02:13:57 +0000 |
| commit | 0e64e0d4fd7c5ae535ba8805c21146a9414f19b3 (patch) | |
| tree | 54d206467fe4652a6c5341d4d867db16490f9126 /clang/lib/CodeGen | |
| parent | 23487e878b0bbd012a756d92b10af8769d52cd1e (diff) | |
| download | bcm5719-llvm-0e64e0d4fd7c5ae535ba8805c21146a9414f19b3.tar.gz bcm5719-llvm-0e64e0d4fd7c5ae535ba8805c21146a9414f19b3.zip | |
Eliminate redundant MangleBuffer class
The only remaining user didn't actually use the non-dynamic storage facility
this class provides.
The std::string is transitional and likely to be StringRefized shortly.
llvm-svn: 210058
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGBlocks.cpp | 8 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 7 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 10 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 4 |
4 files changed, 13 insertions, 16 deletions
diff --git a/clang/lib/CodeGen/CGBlocks.cpp b/clang/lib/CodeGen/CGBlocks.cpp index 21896da3493..71a2447cb5d 100644 --- a/clang/lib/CodeGen/CGBlocks.cpp +++ b/clang/lib/CodeGen/CGBlocks.cpp @@ -1127,11 +1127,9 @@ CodeGenFunction::GenerateBlockFunction(GlobalDecl GD, llvm::FunctionType *fnLLVMType = CGM.getTypes().GetFunctionType(fnInfo); - MangleBuffer name; - CGM.getBlockMangledName(GD, name, blockDecl); - llvm::Function *fn = - llvm::Function::Create(fnLLVMType, llvm::GlobalValue::InternalLinkage, - name.getString(), &CGM.getModule()); + std::string name = CGM.getBlockMangledName(GD, blockDecl); + llvm::Function *fn = llvm::Function::Create( + fnLLVMType, llvm::GlobalValue::InternalLinkage, name, &CGM.getModule()); CGM.SetInternalFunctionAttributes(blockDecl, fn, fnInfo); // Begin generating the function. diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 1869c1c27a1..7cf9cb2417b 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -159,11 +159,8 @@ static std::string GetStaticDeclName(CodeGenFunction &CGF, const VarDecl &D, // Better be in a block declared in global scope. const NamedDecl *ND = cast<NamedDecl>(&D); const DeclContext *DC = ND->getDeclContext(); - if (const BlockDecl *BD = dyn_cast<BlockDecl>(DC)) { - MangleBuffer Name; - CGM.getBlockMangledName(GlobalDecl(), Name, BD); - ContextName = Name.getString(); - } + if (const BlockDecl *BD = dyn_cast<BlockDecl>(DC)) + ContextName = CGM.getBlockMangledName(GlobalDecl(), BD); else llvm_unreachable("Unknown context for block static var decl"); } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(CGF.CurFuncDecl)) { diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index f42e67de0e8..b0e08a2c659 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -489,11 +489,13 @@ StringRef CodeGenModule::getMangledName(GlobalDecl GD) { return Str; } -void CodeGenModule::getBlockMangledName(GlobalDecl GD, MangleBuffer &Buffer, - const BlockDecl *BD) { +std::string CodeGenModule::getBlockMangledName(GlobalDecl GD, + const BlockDecl *BD) { MangleContext &MangleCtx = getCXXABI().getMangleContext(); const Decl *D = GD.getDecl(); - llvm::raw_svector_ostream Out(Buffer.getBuffer()); + + std::string Buffer; + llvm::raw_string_ostream Out(Buffer); if (!D) MangleCtx.mangleGlobalBlock(BD, dyn_cast_or_null<VarDecl>(initializedGlobalDecl.getDecl()), Out); @@ -503,6 +505,8 @@ void CodeGenModule::getBlockMangledName(GlobalDecl GD, MangleBuffer &Buffer, MangleCtx.mangleDtorBlock(DD, GD.getDtorType(), BD, Out); else MangleCtx.mangleBlock(cast<DeclContext>(D), BD, Out); + + return Out.str(); } llvm::GlobalValue *CodeGenModule::GetGlobalValue(StringRef Name) { diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index c54f6dea521..ef18957e3d2 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -71,7 +71,6 @@ class CodeGenOptions; class DiagnosticsEngine; class AnnotateAttr; class CXXDestructorDecl; -class MangleBuffer; class Module; namespace CodeGen { @@ -937,8 +936,7 @@ public: bool AttrOnCallSite); StringRef getMangledName(GlobalDecl GD); - void getBlockMangledName(GlobalDecl GD, MangleBuffer &Buffer, - const BlockDecl *BD); + std::string getBlockMangledName(GlobalDecl GD, const BlockDecl *BD); void EmitTentativeDefinition(const VarDecl *D); |

