[PATCH] Add small text file reader facility.
Diego Novillo
dnovillo at google.com
Tue Jan 7 13:36:22 PST 2014
On Thu, Dec 26, 2013 at 11:45 PM, Chandler Carruth <chandlerc at gmail.com> wrote:
>
> I had a bunch of nit-picky style comments here, as well as some design suggestions, and it just seemed both really confusing and time
> consuming to try to put all of them here in the review.
Thanks. This made things much easier. I'm dropping the FileReader
class and using the new line_iterator class you implemented.
> Comment at: lib/Transforms/Scalar/SampleProfile.cpp:366
> @@ -417,3 +365,3 @@
> void SampleModuleProfile::loadText() {
> - ExternalProfileTextLoader Loader(Filename);
> + FileReader Loader = FileReader::begin(Filename, '#');
Done.
> Comment at: lib/Transforms/Scalar/SampleProfile.cpp:372-379
> @@ -424,7 +371,10 @@
> + "Expected 'symbol table', found " + *Loader);
> + ++Loader;
> int NumSymbols;
> - Line = Loader.readLine();
> - if (Line.getAsInteger(10, NumSymbols))
> - Loader.reportParseError("Expected a number, found " + Line);
> - for (int I = 0; I < NumSymbols; I++)
> - Profiles[Loader.readLine()] = SampleFunctionProfile();
> + if ((*Loader).getAsInteger(10, NumSymbols))
> + reportParseError(Loader.getLineNumber(),
> + "Expected a number, found " + *Loader);
> + ++Loader;
> + for (int I = 0; I < NumSymbols; ++I, ++Loader)
> + Profiles[*Loader] = SampleFunctionProfile();
>
> ----------------
> No where here do you check for reaching the end of the file... Do you want to?
This is no longer how this code is implemented
(http://llvm-reviews.chandlerc.com/D2419).
Diego.
More information about the llvm-commits
mailing list