[llvm] [TextAPI] Add option to filter out unsupported/unknown/invalid targets (PR #195161)
Zixu Wang via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 30 15:50:52 PDT 2026
================
@@ -313,6 +314,12 @@ template <> struct MappingTraits<UndefinedSection> {
template <> struct MappingTraits<SymbolSection> {
static void mapping(IO &IO, SymbolSection &Section) {
IO.mapRequired("targets", Section.Targets);
+ // With SkipUnknownTriples, ScalarTraits of Target accepts unknown
+ // arch/platform scalars without erroring, leaving invalid Targets in the
+ // vector. Drop them so downstream code only sees valid Targets.
----------------
zixu-w wrote:
Yeah there are multiple places here that try to erase or filter invalid targets. I think it's better to refactor to have them in a single place.
A wrapper around `TargetList` and `std::vector<Target>` that exposes a range with filtering should work. I was originally thinking about replacing `LLVM_YAML_IS_FLOW_SEQUENCE_VECTOR(Target)` but don't know how hard it would be to do that with YAML traits.
https://github.com/llvm/llvm-project/pull/195161
More information about the llvm-commits
mailing list