From 889d683ee85fae0a895d2e360a6a2bfac1ad29e5 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Thu, 26 Jun 2008 17:06:02 +0000 Subject: [PATCH] Don't create a whole new string just to copy the elements into it. llvm-svn: 52785 --- lib/CodeGen/MachineModuleInfo.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index 1720745e445..60526643fdf 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -231,11 +231,9 @@ public: } virtual void Apply(std::string &Field) { Constant *C = CI->getOperand(I++); - std::string S; - if (GetConstantStringInfo(C, S)) - Field = S; - else - Field = ""; + // Fills in the string if it succeeds + if (!GetConstantStringInfo(C, Field)) + Field.clear(); } virtual void Apply(DebugInfoDesc *&Field) { Constant *C = CI->getOperand(I++);