Index: llvm/trunk/lib/BinaryFormat/MsgPackDocumentYAML.cpp =================================================================== --- llvm/trunk/lib/BinaryFormat/MsgPackDocumentYAML.cpp +++ llvm/trunk/lib/BinaryFormat/MsgPackDocumentYAML.cpp @@ -61,7 +61,7 @@ llvm_unreachable("not scalar"); break; } - return S; + return OS.str(); } /// Convert the StringRef and use it to set this DocNode (assuming scalar). If Index: llvm/trunk/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp =================================================================== --- llvm/trunk/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp +++ llvm/trunk/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp @@ -323,8 +323,10 @@ static yaml::StringValue regToString(unsigned Reg, const TargetRegisterInfo &TRI) { yaml::StringValue Dest; - raw_string_ostream OS(Dest.Value); - OS << printReg(Reg, &TRI); + { + raw_string_ostream OS(Dest.Value); + OS << printReg(Reg, &TRI); + } return Dest; }