summaryrefslogtreecommitdiffstats
path: root/lld/lib/Driver/WinLinkDriver.cpp
diff options
context:
space:
mode:
authorRui Ueyama <ruiu@google.com>2014-12-14 05:04:22 +0000
committerRui Ueyama <ruiu@google.com>2014-12-14 05:04:22 +0000
commitc39120e101a4c140555852a81581567a548ae295 (patch)
treeea5ddd2f305a2108fb51c6e9400ae75c82e85870 /lld/lib/Driver/WinLinkDriver.cpp
parent5a54977ea8ba690192d98c1fd4571858cc1451ac (diff)
downloadbcm5719-llvm-c39120e101a4c140555852a81581567a548ae295.tar.gz
bcm5719-llvm-c39120e101a4c140555852a81581567a548ae295.zip
More WinLinkInputGraph cleanup.
This function is called only from WinLinkDriver.cpp. Move the function to that file and mark as static. llvm-svn: 224211
Diffstat (limited to 'lld/lib/Driver/WinLinkDriver.cpp')
-rw-r--r--lld/lib/Driver/WinLinkDriver.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/lld/lib/Driver/WinLinkDriver.cpp b/lld/lib/Driver/WinLinkDriver.cpp
index 979825f837c..4b4d5344654 100644
--- a/lld/lib/Driver/WinLinkDriver.cpp
+++ b/lld/lib/Driver/WinLinkDriver.cpp
@@ -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 {
OpenPOWER on IntegriCloud