[lld] r205350 - Remove dynamic casts.
Rui Ueyama
ruiu at google.com
Tue Apr 1 12:00:21 PDT 2014
Author: ruiu
Date: Tue Apr 1 14:00:21 2014
New Revision: 205350
URL: http://llvm.org/viewvc/llvm-project?rev=205350&view=rev
Log:
Remove dynamic casts.
Asserting with cast<T> did not actually make much sense because there was no
need to use dynamic casting in the first place. We could make the compiler to
statically type check these objects.
Modified:
lld/trunk/lib/Driver/GnuLdDriver.cpp
Modified: lld/trunk/lib/Driver/GnuLdDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdDriver.cpp?rev=205350&r1=205349&r2=205350&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdDriver.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdDriver.cpp Tue Apr 1 14:00:21 2014
@@ -266,7 +266,7 @@ bool GnuLdDriver::parse(int argc, const
}
std::unique_ptr<InputGraph> inputGraph(new InputGraph());
- std::stack<InputElement *> controlNodeStack;
+ std::stack<ControlNode *> controlNodeStack;
// Positional options for an Input File
bool isWholeArchive = false;
@@ -430,15 +430,15 @@ bool GnuLdDriver::parse(int argc, const
}
case OPT_start_group: {
- std::unique_ptr<InputElement> controlStart(new ELFGroup(*ctx, index++));
+ std::unique_ptr<ELFGroup> controlStart(new ELFGroup(*ctx, index++));
controlNodeStack.push(controlStart.get());
- cast<ControlNode>(controlNodeStack.top())->processControlEnter();
+ controlNodeStack.top()->processControlEnter();
inputGraph->addInputElement(std::move(controlStart));
break;
}
case OPT_end_group:
- cast<ControlNode>(controlNodeStack.top())->processControlExit();
+ controlNodeStack.top()->processControlExit();
controlNodeStack.pop();
break;
@@ -488,8 +488,7 @@ bool GnuLdDriver::parse(int argc, const
if (controlNodeStack.empty()) {
inputGraph->addInputElement(std::move(inputFile));
} else {
- cast<ControlNode>(controlNodeStack.top())
- ->processInputElement(std::move(inputFile));
+ controlNodeStack.top()->processInputElement(std::move(inputFile));
}
break;
}
More information about the llvm-commits
mailing list