Remove -l flag from Swift interim driver.

Being able to pass -l to the driver isn't so interesting, and it's an
extra field that lives on TranslationUnit for no reason. Just remove it.

This doesn't interfere with autolinking, i.e. inferring -l flags based on
imported modules.

Swift SVN r9241
This commit is contained in:
Jordan Rose
2013-10-12 00:08:06 +00:00
parent ce612d3231
commit ad75aa5021
6 changed files with 5 additions and 42 deletions

View File

@@ -458,9 +458,6 @@ public:
/// \sa SourceFile /// \sa SourceFile
class TranslationUnit : public Module { class TranslationUnit : public Module {
private: private:
/// The list of libraries specified as link-time dependencies at compile time.
ArrayRef<LinkLibrary> LinkLibraries;
/// If non-NULL, an plug-in that should be used when performing external /// If non-NULL, an plug-in that should be used when performing external
/// lookups. /// lookups.
ExternalNameLookup *ExternalLookup = nullptr; ExternalNameLookup *ExternalLookup = nullptr;
@@ -473,14 +470,6 @@ public:
: Module(ModuleKind::TranslationUnit, Name, C) { : Module(ModuleKind::TranslationUnit, Name, C) {
} }
void setLinkLibraries(ArrayRef<LinkLibrary> libs) {
assert(LinkLibraries.empty() && "link libraries already set");
LinkLibraries = libs;
}
ArrayRef<LinkLibrary> getLinkLibraries() const {
return LinkLibraries;
}
void clearLookupCache(); void clearLookupCache();
void cacheVisibleDecls(SmallVectorImpl<ValueDecl *> &&globals) const; void cacheVisibleDecls(SmallVectorImpl<ValueDecl *> &&globals) const;

View File

@@ -47,7 +47,6 @@ class CompilerInvocation {
std::string ClangModuleCachePath; std::string ClangModuleCachePath;
std::vector<std::string> ImportSearchPaths; std::vector<std::string> ImportSearchPaths;
std::vector<std::string> FrameworkSearchPaths; std::vector<std::string> FrameworkSearchPaths;
SmallVector<LinkLibrary, 4> LinkLibraries;
std::string RuntimeIncludePath; std::string RuntimeIncludePath;
std::string SDKPath; std::string SDKPath;
std::vector<std::string> ExtraClangArgs; std::vector<std::string> ExtraClangArgs;
@@ -121,14 +120,6 @@ public:
return ExtraClangArgs; return ExtraClangArgs;
} }
void addLinkLibrary(StringRef name, LibraryKind kind) {
LinkLibraries.push_back({name, kind});
}
ArrayRef<LinkLibrary> getLinkLibraries() const {
return LinkLibraries;
}
void setMainExecutablePath(StringRef Path); void setMainExecutablePath(StringRef Path);
void setRuntimeIncludePath(StringRef Path) { void setRuntimeIncludePath(StringRef Path) {

View File

@@ -1038,20 +1038,12 @@ void Module::forAllVisibleModules(Optional<AccessPathTy> thisPath,
void Module::collectLinkLibraries(LinkLibraryCallback callback) { void Module::collectLinkLibraries(LinkLibraryCallback callback) {
forAllImportedModules<false>(this, AccessPathTy(), forAllImportedModules<false>(this, AccessPathTy(),
[=](ImportedModule import) -> bool { [=](ImportedModule import) -> bool {
Module *module = import.second; auto loadedModule = dyn_cast<LoadedModule>(import.second);
if (isa<BuiltinModule>(module)) { if (!loadedModule)
// The Builtin module requires no libraries.
return true; return true;
}
ModuleLoader &owner = loadedModule->getOwner();
if (auto TU = dyn_cast<TranslationUnit>(module)) { owner.getLinkLibraries(loadedModule, callback);
for (auto lib : TU->getLinkLibraries())
callback(lib);
return true;
}
ModuleLoader &owner = cast<LoadedModule>(module)->getOwner();
owner.getLinkLibraries(module, callback);
return true; return true;
}); });
} }

View File

@@ -124,10 +124,6 @@ bool CompilerInvocation::parseArgs(ArrayRef<const char *> Args,
LangOpts.DebugConstraintSolver = true; LangOpts.DebugConstraintSolver = true;
break; break;
case OPT_link_library:
addLinkLibrary(InputArg->getValue(), LibraryKind::Library);
break;
case OPT_std_EQ: case OPT_std_EQ:
if (strcmp(InputArg->getValue(), "axle") == 0) if (strcmp(InputArg->getValue(), "axle") == 0)
LangOpts.Axle = true; LangOpts.Axle = true;

View File

@@ -123,8 +123,6 @@ void swift::CompilerInstance::doIt() {
TU = new (*Context) TranslationUnit(ID, *Context); TU = new (*Context) TranslationUnit(ID, *Context);
Context->LoadedModules[ID.str()] = TU; Context->LoadedModules[ID.str()] = TU;
TU->setLinkLibraries(Invocation.getLinkLibraries());
auto *SingleInputFile = auto *SingleInputFile =
new (*Context) SourceFile(*TU, Kind, Invocation.getParseStdlib()); new (*Context) SourceFile(*TU, Kind, Invocation.getParseStdlib());
TU->MainSourceFile = SingleInputFile; TU->MainSourceFile = SingleInputFile;

View File

@@ -20,9 +20,6 @@ def parse_as_library : Flag<["-"], "parse-as-library">,
def parse_stdlib : Flag<["-"], "parse-stdlib">, def parse_stdlib : Flag<["-"], "parse-stdlib">,
HelpText<"Parse the input as the swift standard library">; HelpText<"Parse the input as the swift standard library">;
def link_library : Joined<["-"], "l">,
HelpText<"Link the given library into the output product">;
def Xclang : Separate<["-"], "Xclang">, def Xclang : Separate<["-"], "Xclang">,
HelpText<"Pass <arg> to the clang importer">; HelpText<"Pass <arg> to the clang importer">;