[lld] r204855 - [PECOFF] Avoid C-style cast.
Rui Ueyama
ruiu at google.com
Wed Mar 26 14:10:40 PDT 2014
Author: ruiu
Date: Wed Mar 26 16:10:40 2014
New Revision: 204855
URL: http://llvm.org/viewvc/llvm-project?rev=204855&view=rev
Log:
[PECOFF] Avoid C-style cast.
Modified:
lld/trunk/include/lld/Driver/WinLinkInputGraph.h
lld/trunk/lib/Driver/WinLinkDriver.cpp
Modified: lld/trunk/include/lld/Driver/WinLinkInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/WinLinkInputGraph.h?rev=204855&r1=204854&r2=204855&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/WinLinkInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/WinLinkInputGraph.h Wed Mar 26 16:10:40 2014
@@ -59,20 +59,22 @@ public:
/// \brief Represents a ELF control node
class PECOFFGroup : public Group {
public:
- PECOFFGroup() : Group(0) {}
+ PECOFFGroup(PECOFFLinkingContext &ctx) : Group(0), _ctx(ctx) {}
bool validate() override { return true; }
bool dump(raw_ostream &) override { return true; }
/// \brief Parse the group members.
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) override {
- auto *pctx = (PECOFFLinkingContext *)(&ctx);
- std::lock_guard<std::recursive_mutex> lock(pctx->getMutex());
+ std::lock_guard<std::recursive_mutex> lock(_ctx.getMutex());
for (auto &elem : _elements)
if (error_code ec = elem->parse(ctx, diagnostics))
return ec;
return error_code::success();
}
+
+private:
+ PECOFFLinkingContext &_ctx;
};
} // namespace lld
Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=204855&r1=204854&r2=204855&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Wed Mar 26 16:10:40 2014
@@ -1246,7 +1246,7 @@ bool WinLinkDriver::parse(int argc, cons
// Add the library group to the input graph.
if (!isReadingDirectiveSection) {
- auto group = std::unique_ptr<Group>(new PECOFFGroup());
+ auto group = std::unique_ptr<Group>(new PECOFFGroup(ctx));
ctx.setLibraryGroup(group.get());
ctx.inputGraph().addInputElement(std::move(group));
}
More information about the llvm-commits
mailing list