More WinLinkInputGraph cleanup.
authorRui Ueyama <ruiu@google.com>
Sun, 14 Dec 2014 05:04:22 +0000 (05:04 +0000)
committerRui Ueyama <ruiu@google.com>
Sun, 14 Dec 2014 05:04:22 +0000 (05:04 +0000)
This function is called only from WinLinkDriver.cpp.
Move the function to that file and mark as static.

llvm-svn: 224211

lld/include/lld/Driver/WinLinkInputGraph.h
lld/lib/Driver/WinLinkDriver.cpp
lld/lib/Driver/WinLinkInputGraph.cpp

index a801a28..8afc383 100644 (file)
@@ -23,8 +23,6 @@
 
 namespace lld {
 
-extern bool isCOFFLibraryFileExtension(StringRef path);
-
 /// \brief Represents a PECOFF File
 class PECOFFFileNode : public FileNode {
 public:
index 979825f..4b4d534 100644 (file)
@@ -282,10 +282,14 @@ static bool parseManifest(StringRef option, bool &enable, bool &embed,
   return true;
 }
 
-StringRef getObjectPath(PECOFFLinkingContext &ctx, StringRef path) {
+static bool isLibraryFile(StringRef path) {
+  return path.endswith_lower(".lib") || path.endswith_lower(".imp");
+}
+
+static StringRef getObjectPath(PECOFFLinkingContext &ctx, StringRef path) {
   std::string result;
-  if (isCOFFLibraryFileExtension(path)) {
-    result =ctx.searchLibraryFile(path);
+  if (isLibraryFile(path)) {
+    result = ctx.searchLibraryFile(path);
   } else if (llvm::sys::path::extension(path).empty()) {
     result = path.str() + ".obj";
   } else {
@@ -294,8 +298,8 @@ StringRef getObjectPath(PECOFFLinkingContext &ctx, StringRef path) {
   return ctx.allocate(result);
 }
 
-StringRef getLibraryPath(PECOFFLinkingContext &ctx, StringRef path) {
-  std::string result = isCOFFLibraryFileExtension(path)
+static StringRef getLibraryPath(PECOFFLinkingContext &ctx, StringRef path) {
+  std::string result = isLibraryFile(path)
       ? ctx.searchLibraryFile(path)
       : ctx.searchLibraryFile(path.str() + ".lib");
   return ctx.allocate(result);
@@ -1358,7 +1362,7 @@ bool WinLinkDriver::parse(int argc, const char *argv[],
   // Prepare objects to add them to input graph.
   for (StringRef path : inputFiles) {
     path = ctx.allocate(path);
-    if (isCOFFLibraryFileExtension(path)) {
+    if (isLibraryFile(path)) {
       libraries.push_back(std::unique_ptr<FileNode>(
           new PECOFFLibraryNode(ctx, getLibraryPath(ctx, path))));
     } else {
index 24b8f87..792e192 100644 (file)
 
 namespace lld {
 
-bool isCOFFLibraryFileExtension(StringRef path) {
-  return path.endswith_lower(".lib") || path.endswith_lower(".imp");
-}
-
 /// \brief Parse the input file to lld::File.
 std::error_code PECOFFFileNode::parse(const LinkingContext &ctx,
                                       raw_ostream &diagnostics) {