<div dir="ltr">On Wed, Oct 9, 2013 at 11:42 AM, Shankar Easwaran <span dir="ltr"><<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>></span> wrote: <div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">All files cannot be identified with a magic though. For example Linker scripts, and currently YAML files.</blockquote>
<div>
<br></div><div>You could do whatever to identify the file type. identify_magic() is one way, checking the file extension is another. My point is that map-based approach would be simpler than isMyFormat() approach.</div><div>
<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On 10/9/2013 1:36 PM, Rui Ueyama wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
I guess in each isMyFormat(), you would check the given file's magic using<br>
llvm::sys::fs::identify_magic(<u></u>), and then check if it's a known value for<br>
that reader. That would be repeated in each isMyFormat(), which is not very<br>
good.<br>
<br>
I'd do that using a mapping from file magic to reader. I mean, we could<br>
call identify_magic() at some central place, look up the mapping, and then<br>
dispatch.<br>
<br>
On Wed, Oct 9, 2013 at 11:23 AM, Shankar Easwaran<br>
<<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>><u></u>wrote:<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Hi,<br>
<br>
We have a whole bunch of readers(we would have some more too), and was<br>
thinking if we should have a vector of Readers, and have a function<br>
isMyFormat in each of them.<br>
<br>
Any reader that knows to handle, goes ahead and parses the file.<br>
<br>
On a side note, we currently use .objtxt as an figure out if the file is a<br>
YAML file or not. I have added FIXME's in the code, if we could some kind<br>
of magic (or) a better way to figure out if the file is YAML ?<br>
<br>
Thanks<br>
<br>
Shankar Easwaran<br>
<br>
--<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted<br>
by the Linux Foundation<br>
<br></div>
______________________________<u></u>**_________________<div class="im"><br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
</div><a href="http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/**<u></u>mailman/listinfo/llvmdev</a><<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http:<u></u>//lists.cs.uiuc.edu/mailman/<u></u>listinfo/llvmdev</a>><br>
<br>
</blockquote></blockquote><div class="HOEnZb"><div class="h5">
<br>
<br>
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation<br>
<br>
</div></div></blockquote></div><br></div></div>