From ae1daae46132170039ee2631c29cd36e8df4d0e8 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Thu, 15 Jan 2015 08:51:23 +0000 Subject: [PATCH] Simplify. llvm-svn: 226153 --- lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp index cd36c35..24e17d0 100644 --- a/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp +++ b/lld/lib/ReaderWriter/MachO/MachOLinkingContext.cpp @@ -928,14 +928,12 @@ bool MachOLinkingContext::customAtomOrderer(const DefinedAtom *left, return true; } -static File *getFirstFile(const std::unique_ptr &elem) { - FileNode *e = dyn_cast(const_cast(elem.get())); - return e ? e->getFile() : nullptr; -} - static bool isLibrary(const std::unique_ptr &elem) { - File *f = getFirstFile(elem); - return f && (isa(f) || isa(f)); + if (FileNode *node = dyn_cast(const_cast(elem.get()))) { + File *file = node->getFile(); + return isa(file) || isa(file); + } + return false; } // The darwin linker processes input files in two phases. The first phase -- 2.7.4