[CodeGen] Use StringRef. NFC.
Looks like CurFn's name outlives FunctionName, so we can just pass
StringRefs around rather than going from a StringRef to a std::string
to a const char* to a StringRef.
llvm-svn: 285873
diff --git a/clang/lib/CodeGen/CGExprConstant.cpp b/clang/lib/CodeGen/CGExprConstant.cpp
index c268c03..cf83456 100644
--- a/clang/lib/CodeGen/CGExprConstant.cpp
+++ b/clang/lib/CodeGen/CGExprConstant.cpp
@@ -1086,7 +1086,7 @@
return CGM.GetAddrOfConstantCFString(Literal);
}
case Expr::BlockExprClass: {
- std::string FunctionName;
+ StringRef FunctionName;
if (CGF)
FunctionName = CGF->CurFn->getName();
else
@@ -1094,7 +1094,7 @@
// This is not really an l-value.
llvm::Constant *Ptr =
- CGM.GetAddrOfGlobalBlock(cast<BlockExpr>(E), FunctionName.c_str());
+ CGM.GetAddrOfGlobalBlock(cast<BlockExpr>(E), FunctionName);
return ConstantAddress(Ptr, CGM.getPointerAlign());
}
case Expr::CXXTypeidExprClass: {