[PATCH] D83725: [llvm-mc] Add --doc-id=<id> to support multiple documents in a file

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 01:00:21 PDT 2020


jhenderson added a comment.

Just chiming in to say +1 to something that achieves the end goal of being able to have multiple assembly files in the same input. A similar motivation I sometimes run into is wanting multiple input files to a tool, e.g. LLD or llvm-readobj, for testing some behaviour. I end up doing one of three things in this situation: 1) adding a separate file in the "Inputs" directory - this is not great because the test input is far away from the actual test (i.e. not in the same file), making it harder to follow; 2) echoing the second and later inputs to separate files at runtime - this is not great because it has a runtime cost; 3) a recent one I've used occasionally is the `.if` directive to generate different outputs from the same input - this isn't great as it can be somewhat confusing/hard to read at times.

I don't mind which approach is taken (separate tool/addition to llvm-mc), as long as it is simple to use and reasonably efficient.



================
Comment at: llvm/tools/llvm-mc/llvm-mc.cpp:53-54
+    "doc-id",
+    cl::desc("Treat input as separated by \"--- \", feed the part specified "
+             "by \"--- <id>\" to assembler/disassembler"),
+    cl::value_desc("id"));
----------------
This mentions `---` but the code uses `--`. I'd actually prefer `---` probably, but it's minor, so happy to go with a different approach.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83725/new/

https://reviews.llvm.org/D83725





More information about the llvm-commits mailing list