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:
parent
345ddf4259
commit
95a58e9335
@ -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);
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user