[LLVMdev] [lld] Handling a whole bunch of readers

Rui Ueyama ruiu at google.com
Wed Oct 9 11:36:27 PDT 2013


I guess in each isMyFormat(), you would check the given file's magic using
llvm::sys::fs::identify_magic(), and then check if it's a known value for
that reader. That would be repeated in each isMyFormat(), which is not very
good.

I'd do that using a mapping from file magic to reader. I mean, we could
call identify_magic() at some central place, look up the mapping, and then
dispatch.

On Wed, Oct 9, 2013 at 11:23 AM, Shankar Easwaran
<shankare at codeaurora.org>wrote:

> Hi,
>
> We have a whole bunch of readers(we would have some more too), and was
> thinking if we should have a vector of Readers, and have a function
> isMyFormat in each of them.
>
> Any reader that knows to handle, goes ahead and parses the file.
>
> On a side note, we currently use .objtxt as an figure out if the file is a
> YAML file or not. I have added FIXME's in the code, if we could some kind
> of magic (or) a better way to figure out if the file is YAML ?
>
> Thanks
>
> Shankar Easwaran
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
> by the Linux Foundation
>
> ______________________________**_________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131009/cf3a7565/attachment.html>


More information about the llvm-dev mailing list