yurai007 added a comment.

In D120334#3337961 <https://reviews.llvm.org/D120334#3337961>, @jansvoboda11 
wrote:

> The performance implications are pretty interesting! Have you tried avoiding 
> the copy altogether by just storing the reference?

Yes, actually that was my first attempt but I failed miserably. 
LangOpts::LineComment is mutated in Lexer so LangOpts cannot be simply const&. 
Making it non-const reference is technically doable with some extra adjustment 
for Lexer constructors.
However I'm worried a bit how it would impact external LangOpts users after 
mutating LineComment member by Lexer.  As long as LangOpts acts as simple cache 
it's easy to reason about but when we start to share it with Lexer callers I'm 
not longer sure.
That's why eventually base class approach was chosen.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D120334

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to