From 5118df4f582afb69365a45801055e28c10224c90 Mon Sep 17 00:00:00 2001 From: Renato Golin Date: Mon, 19 May 2014 23:25:25 +0000 Subject: Using SmallString and correct addr var git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209180 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 2025f39355..1a36c7914e 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -1778,11 +1778,13 @@ static LValue EmitCapturedFieldLValue(CodeGenFunction &CGF, const FieldDecl *FD, static LValue EmitGlobalNamedRegister(const VarDecl *VD, CodeGenModule &CGM, CharUnits Alignment) { + SmallString<64> Name("llvm.named.register."); AsmLabelAttr *Asm = VD->getAttr(); - llvm::Twine Name("llvm.named.register."+Asm->getLabel()); - SmallString<256> DummyVec; + assert(Asm->getLabel().size() < 64-Name.size() && + "Register name too big"); + Name.append(Asm->getLabel()); llvm::NamedMDNode *M = - CGM.getModule().getOrInsertNamedMetadata(Name.toStringRef(DummyVec)); + CGM.getModule().getOrInsertNamedMetadata(Name); if (M->getNumOperands() == 0) { llvm::MDString *Str = llvm::MDString::get(CGM.getLLVMContext(), Asm->getLabel()); -- cgit v1.2.3