[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 14:51:22 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:

Having to repeat this everywhere we map `"targets"` feels unfortunate. It would be cleaner if we could lift the filtering out into the traits for `TargetList`/`std::vector<Target>`, or other central places in the reader or interface file.

https://github.com/llvm/llvm-project/pull/195161


More information about the llvm-commits mailing list