1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00

[AMDGPU] HSAMD::fromString - replace std::string arg with StringRef. NFCI.

Removes an unnecessary chain of StringRef -> std::string -> StringRef conversions
This commit is contained in:
Simon Pilgrim 2021-01-26 16:09:27 +00:00
parent 345ddf4259
commit 95a58e9335
4 changed files with 5 additions and 5 deletions

View File

@ -15,6 +15,7 @@
#ifndef LLVM_SUPPORT_AMDGPUMETADATA_H
#define LLVM_SUPPORT_AMDGPUMETADATA_H
#include "llvm/ADT/StringRef.h"
#include <cstdint>
#include <string>
#include <system_error>
@ -430,7 +431,7 @@ struct Metadata final {
};
/// Converts \p String to \p HSAMetadata.
std::error_code fromString(std::string String, Metadata &HSAMetadata);
std::error_code fromString(StringRef String, Metadata &HSAMetadata);
/// Converts \p HSAMetadata to \p String.
std::error_code toString(Metadata HSAMetadata, std::string &String);

View File

@ -210,7 +210,7 @@ struct MappingTraits<HSAMD::Metadata> {
namespace AMDGPU {
namespace HSAMD {
std::error_code fromString(std::string String, Metadata &HSAMetadata) {
std::error_code fromString(StringRef String, Metadata &HSAMetadata) {
yaml::Input YamlInput(String);
YamlInput >> HSAMetadata;
return YamlInput.error();

View File

@ -59,7 +59,7 @@ void MetadataStreamerV2::verify(StringRef HSAMetadataString) const {
errs() << "AMDGPU HSA Metadata Parser Test: ";
HSAMD::Metadata FromHSAMetadataString;
if (fromString(std::string(HSAMetadataString), FromHSAMetadataString)) {
if (fromString(HSAMetadataString, FromHSAMetadataString)) {
errs() << "FAIL\n";
return;
}

View File

@ -33,9 +33,8 @@ using namespace llvm::AMDGPU;
bool AMDGPUTargetStreamer::EmitHSAMetadataV2(StringRef HSAMetadataString) {
HSAMD::Metadata HSAMetadata;
if (HSAMD::fromString(std::string(HSAMetadataString), HSAMetadata))
if (HSAMD::fromString(HSAMetadataString, HSAMetadata))
return false;
return EmitHSAMetadata(HSAMetadata);
}