* Fix header block.

* Fix loop style per standards
* Don't create a new Module when the Linker's module is released.
* Add/fix function comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18871 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Reid Spencer 2004-12-13 03:50:50 +00:00
parent ff5f3ab9fe
commit 903f21dd39

View File

@ -1,4 +1,4 @@
//===- lib/Linker/LinkItems.cpp - Link LLVM objects and libraries ---------===// //===- lib/Linker/Linker.cpp - Basic Linker functionality ----------------===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
// //
@ -7,8 +7,7 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// This file contains routines to handle linking together LLVM bytecode files, // This file contains basic Linker functionality that all usages will need.
// and to handle annoying things like static libraries.
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
@ -75,7 +74,7 @@ Linker::addPath(const sys::Path& path) {
void void
Linker::addPaths(const std::vector<std::string>& paths) { Linker::addPaths(const std::vector<std::string>& paths) {
for (unsigned i = 0; i < paths.size(); i++) { for (unsigned i = 0; i != paths.size(); ++i) {
sys::Path aPath; sys::Path aPath;
aPath.setDirectory(paths[i]); aPath.setDirectory(paths[i]);
LibPaths.push_back(aPath); LibPaths.push_back(aPath);
@ -91,9 +90,9 @@ Linker::addSystemPaths() {
Module* Module*
Linker::releaseModule() { Linker::releaseModule() {
Module* result = Composite; Module* result = Composite;
Composite = new Module(ProgramName);
LibPaths.clear(); LibPaths.clear();
Error.clear(); Error.clear();
Composite = 0;
Flags = 0; Flags = 0;
return result; return result;
} }
@ -113,6 +112,8 @@ Linker::LoadObject(const sys::Path &FN) {
return std::auto_ptr<Module>(); return std::auto_ptr<Module>();
} }
// IsLibrary - Determine if "Name" is a library in "Directory". Return
// a non-empty sys::Path if its found, an empty one otherwise.
static inline sys::Path IsLibrary(const std::string& Name, static inline sys::Path IsLibrary(const std::string& Name,
const sys::Path& Directory) { const sys::Path& Directory) {
@ -141,9 +142,8 @@ static inline sys::Path IsLibrary(const std::string& Name,
/// FindLib - Try to convert Filename into the name of a file that we can open, /// FindLib - Try to convert Filename into the name of a file that we can open,
/// if it does not already name a file we can open, by first trying to open /// if it does not already name a file we can open, by first trying to open
/// Filename, then libFilename.[suffix] for each of a set of several common /// Filename, then libFilename.[suffix] for each of a set of several common
/// library suffixes, in each of the directories in Paths and the directory /// library suffixes, in each of the directories in LibPaths. Returns an empty
/// named by the value of the environment variable LLVM_LIB_SEARCH_PATH. Returns /// Path if no matching file can be found.
/// an empty string if no matching file can be found.
/// ///
sys::Path sys::Path
Linker::FindLib(const std::string &Filename) Linker::FindLib(const std::string &Filename)