[PATCH] Separate file parsing from File's constructors.
Shankar Kalpathi Easwaran
shankarke at gmail.com
Thu Dec 11 19:39:02 PST 2014
================
Comment at: include/lld/Core/File.h:156-157
@@ -155,1 +155,4 @@
+ virtual std::error_code parse() { return std::error_code(); }
+ void setParsed(bool val) { _parsed = val; }
+
----------------
Can you add doxygen comments here.
================
Comment at: include/lld/Core/File.h:218
@@ -213,2 +217,3 @@
static atom_collection_empty<AbsoluteAtom> _noAbsoluteAtoms;
+ bool _parsed;
mutable llvm::BumpPtrAllocator _allocator;
----------------
There is only one state being tracked, what about parsed but there was an error ? If there is a call that calls the parse function again, it will return success.
================
Comment at: lib/ReaderWriter/ELF/ELFFile.h:422
@@ -422,4 +421,3 @@
new ELFFile<ELFT>(std::move(mb), atomizeStrings));
- if (std::error_code ec = file->parse())
- return ec;
+ file->_mb = std::move(mb);
return std::move(file);
----------------
Why std::move again ?
================
Comment at: lib/ReaderWriter/MachO/File.h:212
@@ -192,1 +211,3 @@
+ MemoryBuffer *_mb;
+ MachOLinkingContext *_ctx;
----------------
should this be a unique_ptr ?
http://reviews.llvm.org/D6633
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the llvm-commits
mailing list