8000 [codemod] c10::string_view -> std::string_view in fields (#141736) · amathewc/pytorch@98c808d · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit 98c808d

Browse files
r-barnespull[bot]
authored andcommitted
[codemod] c10::string_view -> std::string_view in fields (pytorch#141736)
Summary: `c10::string_view` is being removed, so we need to migrate. Test Plan: Sandcastle Reviewed By: palmje Differential Revision: D65830276 Pull Request resolved: pytorch#141736 Approved by: https://github.com/Skylion007
1 parent b3c9f05 commit 98c808d

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

aten/src/ATen/core/dynamic_type.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ TypePtr DynamicType::fallback() const {
258258
fallbacks.push_back(elem.ty->fallback());
259259
}
260260
if (name_) {
261-
std::vector<c10::string_view> fields;
261+
std::vector<std::string_view> fields;
262262
fields.reserve(arguments_.elems.size());
263263
for (const auto& elem : arguments_.elems) {
264264
// NOLINTNEXTLINE(bugprone-unchecked-optional-access)
@@ -382,7 +382,7 @@ TORCH_API TupleTypePtr ivalue::TupleTypeFactory<TupleType>::fallback(
382382
return nullptr;
383383
#else
384384
const auto& dyn = type.expectRef<DynamicType>();
385-
std::vector<c10::string_view> fields;
385+
std::vector<std::string_view> fields;
386386
std::vector<TypePtr> types;
387387

388388
for (const auto& elem : dyn.arguments().elems) {

aten/src/ATen/core/jit_type.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ struct TORCH_API TupleType : public NamedType {
11541154
const std::vector<TypePtr>& field_types);
11551155

11561156
static TupleTypePtr createNamed(const std::optional<c10::QualifiedName>& name,
1157-
const std::vector<c10::string_view>& field_names,
1157+
const std::vector<std::string_view>& field_names,
11581158
const std::vector<TypePtr>& field_types);
11591159

11601160
static TupleTypePtr create(
@@ -1190,7 +1190,7 @@ struct TORCH_API TupleType : public NamedType {
11901190
const std::shared_ptr<FunctionSchema>& schema() const {
11911191
return schema_;
11921192
}
1193-
std::optional<std::vector<c10::string_view>> names() const;
1193+
std::optional<std::vector<std::string_view>> names() const;
11941194

11951195
static const TypeKind Kind = TypeKind::TupleType;
11961196

aten/src/ATen/core/type.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ TupleTypePtr TupleType::createNamed(
728728

729729
TupleTypePtr TupleType::createNamed(
730730
const std::optional<c10::QualifiedName>& qualName,
731-
const std::vector<c10 8000 ::string_view>& field_names,
731+
const std::vector<std::string_view>& field_names,
732732
const std::vector<TypePtr>& field_types) {
733733
std::vector<IValue> empty_defaults;
734734
return createWithSpec(qualName, field_names, field_types, empty_defaults);
@@ -784,11 +784,11 @@ TupleTypePtr TupleType::createWithSpec(const std::optional<c10::QualifiedName>&
784784
field_types, qualName, std::move(schema))); // NOLINT(modernize-make-shared)
785785
}
786786

787-
std::optional<std::vector<c10::string_view>> TupleType::names() const {
787+
std::optional<std::vector<std::string_view>> TupleType::names() const {
788788
if (!schema_) {
789789
return {};
790790
}
791-
std::vector<c10::string_view> ret;
791+
std::vector<std::string_view> ret;
792792
for (const auto& arg : schema_->arguments()) {
793793
ret.emplace_back(arg.name());
794794
}

aten/src/ATen/core/type_factory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const std::unordered_map<std::string, c10::TypePtr>& DefaultTypeFactory::
6161

6262
c10::TypePtr DefaultTypeFactory::createNamedTuple(
6363
const std::string& name,
64-
const std::vector<c10::string_view>& fields,
64+
const std::vector<std::string_view>& fields,
6565
const std::vector<c10::TypePtr>& types) {
6666
return c10::TupleType::createNamed(name, fields, types);
6767
}

aten/src/ATen/core/type_factory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct TORCH_API TypeFactoryBase<c10::Type> {
8080
}
8181
static c10::TypePtr createNamedTuple(
8282
const std::string& name,
83-
const std::vector<c10::string_view>& fields,
83+
const std::vector<std::string_view>& fields,
8484
const std::vector<c10::TypePtr>& types);
8585
template <typename T>
8686
C10_ERASE static c10::TypePtr createNamed(const std::string& name) {

0 commit comments

Comments
 (0)
0