[libc] Fix build after 777180a32b.

Implicit conversion from llvm::StringRef to std::string was made
explicit in the above commit.
This commit is contained in:
Siva Chandra Reddy 2020-01-29 13:29:52 -08:00
parent e8e6e13176
commit b9826408e4
3 changed files with 12 additions and 10 deletions

View File

@ -58,7 +58,7 @@ void Generator::parseCommandArgs(llvm::StringRef ArgStr, ArgVector &Args) {
A = A.trim(' ');
if (A.startswith(ParamNamePrefix) && A.endswith(ParamNameSuffix)) {
A = A.drop_front(ParamNamePrefixSize).drop_back(ParamNameSuffixSize);
A = ArgMap[A];
A = ArgMap[std::string(A)];
}
}
}

View File

@ -31,7 +31,7 @@ llvm::cl::list<std::string> ReplacementValues(
void ParseArgValuePairs(std::unordered_map<std::string, std::string> &Map) {
for (std::string &R : ReplacementValues) {
auto Pair = llvm::StringRef(R).split('=');
Map[Pair.first] = Pair.second;
Map[std::string(Pair.first)] = std::string(Pair.second);
}
}

View File

@ -102,7 +102,7 @@ class APIGenerator {
std::string getTypeAsString(llvm::Record *TypeRecord) {
if (isaNamedType(TypeRecord) || isaStructType(TypeRecord)) {
return TypeRecord->getValueAsString("Name");
return std::string(TypeRecord->getValueAsString("Name"));
} else if (isaPtrType(TypeRecord)) {
return getTypeAsString(TypeRecord->getValueAsDef("PointeeType")) + " *";
} else if (isaConstType(TypeRecord)) {
@ -123,15 +123,17 @@ class APIGenerator {
auto MacroSpecList = HeaderSpec->getValueAsListOfDefs("Macros");
// TODO: Trigger a fatal error on duplicate specs.
for (llvm::Record *MacroSpec : MacroSpecList)
MacroSpecMap[MacroSpec->getValueAsString("Name")] = MacroSpec;
MacroSpecMap[std::string(MacroSpec->getValueAsString("Name"))] =
MacroSpec;
auto TypeSpecList = HeaderSpec->getValueAsListOfDefs("Types");
for (llvm::Record *TypeSpec : TypeSpecList)
TypeSpecMap[TypeSpec->getValueAsString("Name")] = TypeSpec;
TypeSpecMap[std::string(TypeSpec->getValueAsString("Name"))] =
TypeSpec;
auto FunctionSpecList = HeaderSpec->getValueAsListOfDefs("Functions");
for (llvm::Record *FunctionSpec : FunctionSpecList) {
FunctionSpecMap[FunctionSpec->getValueAsString("Name")] =
FunctionSpecMap[std::string(FunctionSpec->getValueAsString("Name"))] =
FunctionSpec;
}
}
@ -144,19 +146,19 @@ class APIGenerator {
// generating the API.
auto MacroDefList = PublicAPI->getValueAsListOfDefs("Macros");
for (llvm::Record *MacroDef : MacroDefList)
MacroDefsMap[MacroDef->getValueAsString("Name")] = MacroDef;
MacroDefsMap[std::string(MacroDef->getValueAsString("Name"))] = MacroDef;
auto TypeDeclList = PublicAPI->getValueAsListOfDefs("TypeDeclarations");
for (llvm::Record *TypeDecl : TypeDeclList)
TypeDeclsMap[TypeDecl->getValueAsString("Name")] = TypeDecl;
TypeDeclsMap[std::string(TypeDecl->getValueAsString("Name"))] = TypeDecl;
auto StructList = PublicAPI->getValueAsListOfStrings("Structs");
for (llvm::StringRef StructName : StructList)
Structs.insert(StructName);
Structs.insert(std::string(StructName));
auto FunctionList = PublicAPI->getValueAsListOfStrings("Functions");
for (llvm::StringRef FunctionName : FunctionList)
Functions.insert(FunctionName);
Functions.insert(std::string(FunctionName));
}
void index(llvm::RecordKeeper &Records) {