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 {
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);
// 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 {
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) {