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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 02:40:48 PDT 2020


grimar added a comment.

I like the aim of this patch and personally I'd slightly prefer to build in this functionality into llvm-mc rather than have an utility,
because it might make test cases shorter and a bit simpler.

One point from me: yaml2obj by default has `--docnum=0`. I.e. you can either specify the `--docnum`, or omit and have the same result.
But llvm-mc should not have such behavior. So I just want to ensure that when no `--doc-id` is requested, then llvm-mc does nothing
for an input. I see it is what this patch implements already, but there is no test for this case?



================
Comment at: llvm/tools/llvm-mc/llvm-mc.cpp:317
 
+static void handleDocId(std::unique_ptr<MemoryBuffer> &Buf, StringRef ProgName,
+                        StringRef FileName) {
----------------
Consider making this more generic

```
Expected<std::unique_ptr<MemoryBuffer>> extractDocWithID(const MemoryBuffer& Buf, unsigned ID).
```




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