[PATCH] lld] handle the case of errors from createLinkerInput

Rui Ueyama ruiu at google.com
Mon Sep 2 17:01:00 PDT 2013



================
Comment at: include/lld/Driver/CoreInputGraph.h:49
@@ +48,3 @@
+    llvm_unreachable("not handling errors");
+  }
+
----------------
I'd move this method to FileNode and remove duplciate member functions calling llvm_unreachable() from the subclasses.

================
Comment at: include/lld/Driver/GnuLDInputGraph.h:77
@@ -72,2 +76,3 @@
   bool _asNeeded : 1;
+  bool _isDashlPrefix : 1;
   std::vector<StringRef> _libraryPaths;
----------------
Why did you make them bitfields? I think we don't usually make boolean fields bitfields only because they need only 1 bit.

================
Comment at: lib/Driver/GnuLdDriver.cpp:99
@@ +98,3 @@
+  return "Unknown Error";
+}
+
----------------
Looks like this is the only method that really implements errStr(). Do you think we can use one function to stringize error code, instead of defining member functions for each FileNode? Looks like we can just remove "-l"from message (make it "Unable to find library" + path) to make it sense in all platforms.

================
Comment at: lib/Driver/GnuLdDriver.cpp:96
@@ +95,3 @@
+      return (Twine("Unable to find library -l") + _path).str();
+    return (Twine("Unable to find file ") + _path).str();
+  }
----------------
Use-after-return?


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



More information about the llvm-commits mailing list