[lld] r224211 - More WinLinkInputGraph cleanup.

Rui Ueyama ruiu at google.com
Sat Dec 13 21:04:22 PST 2014


Author: ruiu
Date: Sat Dec 13 23:04:22 2014
New Revision: 224211

URL: http://llvm.org/viewvc/llvm-project?rev=224211&view=rev
Log:
More WinLinkInputGraph cleanup.

This function is called only from WinLinkDriver.cpp.
Move the function to that file and mark as static.

Modified:
    lld/trunk/include/lld/Driver/WinLinkInputGraph.h
    lld/trunk/lib/Driver/WinLinkDriver.cpp
    lld/trunk/lib/Driver/WinLinkInputGraph.cpp

Modified: lld/trunk/include/lld/Driver/WinLinkInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/WinLinkInputGraph.h?rev=224211&r1=224210&r2=224211&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/WinLinkInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/WinLinkInputGraph.h Sat Dec 13 23:04:22 2014
@@ -23,8 +23,6 @@
 
 namespace lld {
 
-extern bool isCOFFLibraryFileExtension(StringRef path);
-
 /// \brief Represents a PECOFF File
 class PECOFFFileNode : public FileNode {
 public:

Modified: lld/trunk/lib/Driver/WinLinkDriver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkDriver.cpp?rev=224211&r1=224210&r2=224211&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkDriver.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkDriver.cpp Sat Dec 13 23:04:22 2014
@@ -282,10 +282,14 @@ static bool parseManifest(StringRef opti
   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(PECOFFLinkingCon
   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, cons
   // 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 {

Modified: lld/trunk/lib/Driver/WinLinkInputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkInputGraph.cpp?rev=224211&r1=224210&r2=224211&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkInputGraph.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkInputGraph.cpp Sat Dec 13 23:04:22 2014
@@ -11,10 +11,6 @@
 
 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) {





More information about the llvm-commits mailing list