Examples:
yaml2obj -D MACHINE=EM_386 a.yaml -o a.o yaml2obj -D MACHINE=0x1234 a.yaml -o a.o
where a.yaml contains:
--- !ELF FileHeader: Class: ELFCLASS64 Data: ELFDATA2MSB Type: ET_REL Machine: [[MACHINE]]
Differential D73821
[yaml2obj] Add -D k=v to preprocess the input YAML MaskRay on Jan 31 2020, 5:23 PM. Authored by
Details Examples: yaml2obj -D MACHINE=EM_386 a.yaml -o a.o yaml2obj -D MACHINE=0x1234 a.yaml -o a.o where a.yaml contains: --- !ELF FileHeader: Class: ELFCLASS64 Data: ELFDATA2MSB Type: ET_REL Machine: [[MACHINE]]
Diff Detail
Unit Tests Event TimelineComment Actions Unit tests: fail. 62372 tests passed, 2 failed and 839 were skipped. failed: LLVM.tools/yaml2obj/ELF/unused-overridden.yaml failed: libc++.std/thread/thread_mutex/thread_mutex_requirements/thread_mutex_requirements_mutex/thread_mutex_class/try_lock.pass.cpp clang-tidy: fail. clang-tidy found 0 errors and 5 warnings. 0 of them are added as review comments below (why?). clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch. Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project. Comment Actions Unit tests: pass. 62374 tests passed, 0 failed and 839 were skipped. clang-tidy: fail. clang-tidy found 0 errors and 5 warnings. 0 of them are added as review comments below (why?). clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch. Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project. Comment Actions Unit tests: fail. 62379 tests passed, 1 failed and 839 were skipped. failed: libc++.std/thread/thread_mutex/thread_mutex_requirements/thread_mutex_requirements_mutex/thread_mutex_recursive/try_lock.pass.cpp clang-tidy: fail. clang-tidy found 0 errors and 5 warnings. 0 of them are added as review comments below (why?). clang-format: pass. Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project. Comment Actions Sorry, but I'd probably prefer to have a different approach. --- !ELF FileHeader: [[FOO]]: ELFCLASS32 Data: ELFDATA2LSB Type: ET_REL Machine: [[MACHINE]] And then have a code that replaces `[[MACHINE]]', '[[FOO]]' strings in the input data yaml2obj -DMACHINE="XXX" -DFOO="Class" gives --- !ELF FileHeader: Class: ELFCLASS32 Data: ELFDATA2LSB Type: ET_REL Machine: XXX It is much more generic (can be used for all targets, fields, etc), and it should be much simpler to implement. And I do not have any concerns about the fact we modify the input YAML description here, Comment Actions I mostly agree with @grimar, although I don't think it's necessary to support arbitrary Key names, only Value names. Should the proposal (in whatever form it takes) go up on the mailing lists as an RFC? It feels like a useful feature that more people might want to talk about. Comment Actions Unit tests: fail. 62422 tests passed, 1 failed and 845 were skipped. failed: LLVM.Analysis/ConstantFolding/vscale-shufflevector.ll clang-tidy: pass. clang-format: pass. Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project. Comment Actions I am going to debug this. My first impression is that the direction is right,
Comment Actions Address review comments.
Comment Actions Unit tests: unknown. clang-tidy: unknown. clang-format: unknown. Build artifacts: diff.json, console-log.txt Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project. Comment Actions Simplify with Buf.find_first_of (OT: StringRef::find_first_of is O(n * 256) but the method can be imroved.) Comment Actions Unit tests: unknown. clang-tidy: pass. clang-format: pass. Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project. Comment Actions Unit tests: unknown. clang-tidy: pass. clang-format: pass. Build artifacts: diff.json, clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project.
Comment Actions Unit tests: fail. 62504 tests passed, 8 failed and 844 were skipped. failed: LLVM.tools/yaml2obj/help.test failed: lld.ELF/compressed-input-alignment.test failed: lld.ELF/invalid/bad-reloc-target.test failed: lld.ELF/invalid/common-symbol-alignment.test failed: lld.ELF/invalid/dynamic-section-broken.test failed: lld.ELF/invalid/symtab-sh-info.s failed: lld.ELF/mips-elf-flags-err.test failed: lld.ELF/mips-fp-flags-err.test clang-tidy: pass. clang-format: fail. Please format your changes with clang-format by running git-clang-format HEAD^ or applying this patch. Build artifacts: clang-tidy.txt, clang-format.patch, CMakeCache.txt, console-log.txt, test-results.xml Pre-merge checks is in beta. Report issue. Please join beta or enable it for your project. Comment Actions OK. I have 2 non-strong comments/suggestions about the current code.
|
This is a refactoring change, right? I'd leave such changes for a follow-up patch(es).