[lld] r205737 - Early continue to reduce nesting.
Rui Ueyama
ruiu at google.com
Mon Apr 7 14:13:33 PDT 2014
Author: ruiu
Date: Mon Apr 7 16:13:33 2014
New Revision: 205737
URL: http://llvm.org/viewvc/llvm-project?rev=205737&view=rev
Log:
Early continue to reduce nesting.
Modified:
lld/trunk/lib/Driver/GnuLdInputGraph.cpp
Modified: lld/trunk/lib/Driver/GnuLdInputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdInputGraph.cpp?rev=205737&r1=205736&r2=205737&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdInputGraph.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdInputGraph.cpp Mon Apr 7 16:13:33 2014
@@ -77,20 +77,20 @@ error_code ELFGNULdScript::parse(const L
if (error_code ec = GNULdScript::parse(ctx, diagnostics))
return ec;
for (const script::Command *c : _linkerScript->_commands) {
- if (auto group = dyn_cast<script::Group>(c)) {
- std::unique_ptr<Group> groupStart(new Group());
- for (const script::Path &path : group->getPaths()) {
- // TODO : Propagate Set WholeArchive/dashlPrefix
- attributes.setAsNeeded(path._asNeeded);
- auto inputNode = new ELFFileNode(
- _elfLinkingContext, _elfLinkingContext.allocateString(path._path),
- attributes);
- std::unique_ptr<InputElement> inputFile(inputNode);
- cast<Group>(groupStart.get())->addFile(
- std::move(inputFile));
- }
- _expandElements.push_back(std::move(groupStart));
+ auto *group = dyn_cast<script::Group>(c);
+ if (!group)
+ continue;
+ std::unique_ptr<Group> groupStart(new Group());
+ for (const script::Path &path : group->getPaths()) {
+ // TODO : Propagate Set WholeArchive/dashlPrefix
+ attributes.setAsNeeded(path._asNeeded);
+ auto inputNode = new ELFFileNode(
+ _elfLinkingContext, _elfLinkingContext.allocateString(path._path),
+ attributes);
+ std::unique_ptr<InputElement> inputFile(inputNode);
+ cast<Group>(groupStart.get())->addFile(std::move(inputFile));
}
+ _expandElements.push_back(std::move(groupStart));
}
return error_code::success();
}
More information about the llvm-commits
mailing list