@@ -208,16 +208,16 @@ struct MultilibSetSerialization {
208
208
SmallVector<MultilibGroupSerialization> Groups;
209
209
SmallVector<MultilibSerialization> Multilibs;
210
210
SmallVector<MultilibSet::FlagMatcher> FlagMatchers;
211
- SmallVector<custom_flag::CustomFlagDeclarationPtr > CustomFlagDeclarations;
211
+ SmallVector<custom_flag::DeclarationPtr > CustomFlagDeclarations;
212
212
};
213
213
214
214
} // end anonymous namespace
215
215
216
216
LLVM_YAML_IS_SEQUENCE_VECTOR (MultilibSerialization)
217
217
LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibGroupSerialization)
218
218
LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibSet::FlagMatcher)
219
- LLVM_YAML_IS_SEQUENCE_VECTOR(custom_flag::CustomFlagValueDetail )
220
- LLVM_YAML_IS_SEQUENCE_VECTOR(custom_flag::CustomFlagDeclarationPtr )
219
+ LLVM_YAML_IS_SEQUENCE_VECTOR(custom_flag::ValueDetail )
220
+ LLVM_YAML_IS_SEQUENCE_VECTOR(custom_flag::DeclarationPtr )
221
221
222
222
template <> struct llvm::yaml::MappingTraits<MultilibSerialization> {
223
223
static void mapping (llvm::yaml::IO &io, MultilibSerialization &V) {
@@ -267,14 +267,14 @@ template <> struct llvm::yaml::MappingTraits<MultilibSet::FlagMatcher> {
267
267
};
268
268
269
269
template <>
270
- struct llvm ::yaml::MappingContextTraits<custom_flag::CustomFlagValueDetail ,
270
+ struct llvm ::yaml::MappingContextTraits<custom_flag::ValueDetail ,
271
271
llvm::SmallSet<std::string, 32 >> {
272
- static void mapping (llvm::yaml::IO &io, custom_flag::CustomFlagValueDetail &V,
272
+ static void mapping (llvm::yaml::IO &io, custom_flag::ValueDetail &V,
273
273
llvm::SmallSet<std::string, 32 > &) {
274
274
io.mapRequired (" Name" , V.Name );
275
275
io.mapOptional (" ExtraBuildArgs" , V.ExtraBuildArgs );
276
276
}
277
- static std::string validate (IO &io, custom_flag::CustomFlagValueDetail &V,
277
+ static std::string validate (IO &io, custom_flag::ValueDetail &V,
278
278
llvm::SmallSet<std::string, 32 > &NameSet) {
279
279
if (V.Name .empty ())
280
280
return " custom flag value requires a name" ;
@@ -285,13 +285,12 @@ struct llvm::yaml::MappingContextTraits<custom_flag::CustomFlagValueDetail,
285
285
};
286
286
287
287
template <>
288
- struct llvm ::yaml::MappingContextTraits<custom_flag::CustomFlagDeclarationPtr ,
288
+ struct llvm ::yaml::MappingContextTraits<custom_flag::DeclarationPtr ,
289
289
llvm::SmallSet<std::string, 32 >> {
290
- static void mapping (llvm::yaml::IO &io,
291
- custom_flag::CustomFlagDeclarationPtr &V,
290
+ static void mapping (llvm::yaml::IO &io, custom_flag::DeclarationPtr &V,
292
291
llvm::SmallSet<std::string, 32 > &NameSet) {
293
292
assert (!V);
294
- V = std::make_shared<custom_flag::CustomFlagDeclaration >();
293
+ V = std::make_shared<custom_flag::Declaration >();
295
294
io.mapRequired (" Name" , V->Name );
296
295
io.mapRequired (" Values" , V->ValueList , NameSet);
297
296
std::string DefaultValueName;
@@ -300,24 +299,19 @@ struct llvm::yaml::MappingContextTraits<custom_flag::CustomFlagDeclarationPtr,
300
299
for (auto [Idx, Value] : llvm::enumerate (V->ValueList )) {
301
300
Value.Decl = V;
302
301
if (Value.Name == DefaultValueName) {
303
- assert (V->DefaultValueIdx == ~ 0UL );
302
+ assert (! V->DefaultValueIdx );
304
303
V->DefaultValueIdx = Idx;
305
304
}
306
305
}
307
306
}
308
- static std::string validate (IO &io, custom_flag::CustomFlagDeclarationPtr &V,
307
+ static std::string validate (IO &io, custom_flag::DeclarationPtr &V,
309
308
llvm::SmallSet<std::string, 32 > &) {
310
309
if (V->Name .empty ())
311
310
return " custom flag requires a name" ;
312
311
if (V->ValueList .empty ())
313
312
return " custom flag must have at least one value" ;
314
- if (V->DefaultValueIdx >= V-> ValueList . size () )
313
+ if (! V->DefaultValueIdx )
315
314
return " custom flag must have a default value" ;
316
- if (llvm::any_of (V->ValueList , [&V](const auto &Value) {
317
- return !Value.Decl || Value.Decl != V;
318
- }))
319
- return " custom flag value missing reference to its custom flag "
320
- " declaration" ;
321
315
return {};
322
316
}
323
317
};
0 commit comments