Removes lots of else-ifs from ScriptParser::run();
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
Removed all changes except one because:
- Moving allocator inside ScriptParser was not good idea. Its much more clear to know it's lifetime is attached to LinkerScript class and not to parser. It did not work correctly I think.
- Restored checks of Error flag where removed. That also was incorrect change, thanks to Rui Ueyama for noticing that during review of another patch.
ELF/LinkerScript.cpp | ||
---|---|---|
143 ↗ | (On Diff #48291) | Actually. The if is on a repeated call to find. So just use auto C = Cmd.find(Tok); C->second(*this); |
Comment Actions
LGTM with a few nits.
ELF/LinkerScript.cpp | ||
---|---|---|
92 ↗ | (On Diff #48291) | Remove this function and move the code inside the constructor. |
143 ↗ | (On Diff #48291) | Please rename C -> It (because it is not a command but an iterator.) |
144–145 ↗ | (On Diff #48291) | Please assign to a local variable to make the actual type explicit. if (It != Cmd.end()) { std::function<void(ScriptParser &)> &Handler = It->second; Handler(); } else { setError(...); } |