@@ -208,16 +208,16 @@ struct MultilibSetSerialization {
208208 SmallVector<MultilibGroupSerialization> Groups;
209209 SmallVector<MultilibSerialization> Multilibs;
210210 SmallVector<MultilibSet::FlagMatcher> FlagMatchers;
211- SmallVector<custom_flag::CustomFlagDeclarationPtr > CustomFlagDeclarations;
211+ SmallVector<custom_flag::DeclarationPtr > CustomFlagDeclarations;
212212};
213213
214214} // end anonymous namespace
215215
216216LLVM_YAML_IS_SEQUENCE_VECTOR (MultilibSerialization)
217217LLVM_YAML_IS_SEQUENCE_VECTOR(MultilibGroupSerialization)
218218LLVM_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 )
221221
222222template <> struct llvm::yaml::MappingTraits<MultilibSerialization> {
223223 static void mapping (llvm::yaml::IO &io, MultilibSerialization &V) {
@@ -267,14 +267,14 @@ template <> struct llvm::yaml::MappingTraits<MultilibSet::FlagMatcher> {
267267};
268268
269269template <>
270- struct llvm ::yaml::MappingContextTraits<custom_flag::CustomFlagValueDetail ,
270+ struct llvm ::yaml::MappingContextTraits<custom_flag::ValueDetail ,
271271 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,
273273 llvm::SmallSet<std::string, 32 > &) {
274274 io.mapRequired (" Name" , V.Name );
275275 io.mapOptional (" ExtraBuildArgs" , V.ExtraBuildArgs );
276276 }
277- static std::string validate (IO &io, custom_flag::CustomFlagValueDetail &V,
277+ static std::string validate (IO &io, custom_flag::ValueDetail &V,
278278 llvm::SmallSet<std::string, 32 > &NameSet) {
279279 if (V.Name .empty ())
280280 return " custom flag value requires a name" ;
@@ -285,13 +285,12 @@ struct llvm::yaml::MappingContextTraits<custom_flag::CustomFlagValueDetail,
285285};
286286
287287template <>
288- struct llvm ::yaml::MappingContextTraits<custom_flag::CustomFlagDeclarationPtr ,
288+ struct llvm ::yaml::MappingContextTraits<custom_flag::DeclarationPtr ,
289289 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,
292291 llvm::SmallSet<std::string, 32 > &NameSet) {
293292 assert (!V);
294- V = std::make_shared<custom_flag::CustomFlagDeclaration >();
293+ V = std::make_shared<custom_flag::Declaration >();
295294 io.mapRequired (" Name" , V->Name );
296295 io.mapRequired (" Values" , V->ValueList , NameSet);
297296 std::string DefaultValueName;
@@ -300,24 +299,19 @@ struct llvm::yaml::MappingContextTraits<custom_flag::CustomFlagDeclarationPtr,
300299 for (auto [Idx, Value] : llvm::enumerate (V->ValueList )) {
301300 Value.Decl = V;
302301 if (Value.Name == DefaultValueName) {
303- assert (V->DefaultValueIdx == ~ 0UL );
302+ assert (! V->DefaultValueIdx );
304303 V->DefaultValueIdx = Idx;
305304 }
306305 }
307306 }
308- static std::string validate (IO &io, custom_flag::CustomFlagDeclarationPtr &V,
307+ static std::string validate (IO &io, custom_flag::DeclarationPtr &V,
309308 llvm::SmallSet<std::string, 32 > &) {
310309 if (V->Name .empty ())
311310 return " custom flag requires a name" ;
312311 if (V->ValueList .empty ())
313312 return " custom flag must have at least one value" ;
314- if (V->DefaultValueIdx >= V-> ValueList . size () )
313+ if (! V->DefaultValueIdx )
315314 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" ;
321315 return {};
322316 }
323317};
0 commit comments