Fix conversions in clang and examples
diff --git a/llvm/examples/Kaleidoscope/Chapter9/toy.cpp b/llvm/examples/Kaleidoscope/Chapter9/toy.cpp
index 21c8993..23b25b1 100644
--- a/llvm/examples/Kaleidoscope/Chapter9/toy.cpp
+++ b/llvm/examples/Kaleidoscope/Chapter9/toy.cpp
@@ -884,11 +884,10 @@
/// CreateEntryBlockAlloca - Create an alloca instruction in the entry block of
/// the function. This is used for mutable variables etc.
static AllocaInst *CreateEntryBlockAlloca(Function *TheFunction,
- const std::string &VarName) {
+ StringRef VarName) {
IRBuilder<> TmpB(&TheFunction->getEntryBlock(),
TheFunction->getEntryBlock().begin());
- return TmpB.CreateAlloca(Type::getDoubleTy(TheContext), nullptr,
- VarName.c_str());
+ return TmpB.CreateAlloca(Type::getDoubleTy(TheContext), nullptr, VarName);
}
Value *NumberExprAST::codegen() {
@@ -1277,7 +1276,7 @@
Builder.CreateStore(&Arg, Alloca);
// Add arguments to variable symbol table.
- NamedValues[Arg.getName()] = Alloca;
+ NamedValues[std::string(Arg.getName())] = Alloca;
}
KSDbgInfo.emitLocation(Body.get());