[flang-dev] RFC: Porting SourceFile to using LLVM file handling facilities

David Truby via flang-dev flang-dev at lists.llvm.org
Wed Feb 19 06:31:45 PST 2020


Hi All,

Does anyone have any insight into this? I’m wondering if it is safe to rework this section of the code and remove the carriage return rewriting, but I don’t want to start until I understand why it’s there to start with.

Thanks
David Truby

> On 29 Jan 2020, at 16:03, David Truby via flang-dev <flang-dev at lists.llvm.org> wrote:
> 
> Hi All,
> 
> I’ve been looking at SourceFile as the main user of posix file handling functions and how this could be ported to use LLVM’s file handling facilities. I noticed that we are mmapping for sufficiently large files and just reading small ones, which seems like a good fit for the llvm::MemoryBuffer class (which does the same thing).
> Does this seem like a sensible route to take to anyone that might be more familiar with the code than me?
> 
> One thing that I noticed however is that the input file is being rewritten (in memory) to remove carriage returns. Does someone more familiar with the preprocessor or parser than me know if this is because we can’t handle carriage returns later? If so, how difficult would it to be to add handling for them (just treating them as whitespace seems appropriate)?
> I think we should avoid rewriting the input file if possible as it requires reading the whole thing one more time than is strictly necessary.
> 
> Thanks
> David Truby
> _______________________________________________
> flang-dev mailing list
> flang-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/flang-dev



More information about the flang-dev mailing list