<div dir="ltr"><div dir="ltr">On Mon, Sep 6, 2021 at 4:58 PM lxsameer <<a href="mailto:lxsameer@lxsameer.com">lxsameer@lxsameer.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>Sorry about the terminology, I was thinking about CRTP style traits. I see CRTP based classes and templates quite often it the LLVM source code.</div></blockquote><div><br>Yeah, there's a fair bit of CRTP, and traits, but they are different things - <a href="https://www.internalpointers.com/post/quick-primer-type-traits-modern-cpp">https://www.internalpointers.com/post/quick-primer-type-traits-modern-cpp</a> discusses traits, for some details.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>So I think the current SourceMgr can be renamed to something like `DefaultSourceManager` that implement the `SourceMgr` CRTP trait ( sorry I don't know the exact term here).</div></blockquote><div><br>I'm still a bit unclear on how the existing SourceMgr-using code would work - it'd have to be updated to be templated on the specific SourceMgr implementation in use, would it? Some other ideas?<br><br>Might be worth a more narrowly defined discussion about what extensibility/features you're looking for in SourceMgr, without the need to create a whole new hierarchy.<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div> <br></div><div><div></div><div></div></div><div><br></div><div><div>‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐<br></div><div> On Tuesday, September 7th, 2021 at 12:50 AM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br></div></div><div><br></div><blockquote type="cite">
<div dir="ltr"><div dir="ltr">On Mon, Sep 6, 2021 at 3:59 PM lxsameer via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" rel="noreferrer nofollow noopener" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">Hey folks,<br>
Hope you're doing well. <br>
<br>
<br>
It seems to me that it is not possible to extend the current behavior of `llvm::SourceMgr` (at least I couldn't think of any solution) and it is quite C/C++ish ( for lack of a better word).<br>
<br>
For my use case, I need to tweak it a little bit and since there is now way to do that, I have to write my own which means I'm going to lose the ability to use any llvm api that expect a source manager and that's a big price to pay.<br>
<br>
It seems that the source manger will benefits from a trait like design. This way, any front end that need a customized source manager can easily do that and the current source manager would be an implementation of that trait.<br></blockquote><div><br>I /think/ the C++ terminology that's a closer match for what you're describing might be a "concept" rather than a "trait"?<br><br>But then, if I'm understanding correctly, all the code that currently is written in terms of the SourceMgr would have to become a template so it can be used by different implementations of the SourceMgr concept? That, at first guess, seems unlikely/infeasible?<br><br></div><div> - Dave</div></div></div>
</blockquote></blockquote></div></div>