[PATCH] Refactor parseFile API to use LinkerInput directly

Joerg Sonnenberger joerg at NetBSD.org
Wed Sep 4 11:02:28 PDT 2013



================
Comment at: lib/Driver/DarwinLdDriver.cpp:86
@@ -77,1 +85,3 @@
+
+  return std::unique_ptr<LinkerInput>(new LinkerInput(std::move(mb), *filePath));
 }
----------------
Rui Ueyama wrote:
> We shouldn't have duplicate code in each driver.
I am not complete happy with this part either. I see two options for dealing with this:

# Provide readFile as factory-like method of LinkerInput, since a constructor can't return an error.
# Move the default implementation back into FileNode. The specializations just need to add whatever flags are needed and can do that after the linker input is created.

The second option looks cleaner to me.


http://llvm-reviews.chandlerc.com/D1598



More information about the llvm-commits mailing list