[llvm-commits] CVS: llvm/lib/Linker/LinkArchives.cpp LinkItems.cpp LinkModules.cpp Linker.cpp

Misha Brukman brukman at cs.uiuc.edu
Thu Apr 21 15:47:47 PDT 2005



Changes in directory llvm/lib/Linker:

LinkArchives.cpp updated: 1.48 -> 1.49
LinkItems.cpp updated: 1.5 -> 1.6
LinkModules.cpp updated: 1.104 -> 1.105
Linker.cpp updated: 1.4 -> 1.5
---
Log message:

Remove trailing whitespace


---
Diffs of the changes:  (+56 -56)

 LinkArchives.cpp |   30 +++++++++++++++---------------
 LinkItems.cpp    |   18 +++++++++---------
 LinkModules.cpp  |   36 ++++++++++++++++++------------------
 Linker.cpp       |   28 ++++++++++++++--------------
 4 files changed, 56 insertions(+), 56 deletions(-)


Index: llvm/lib/Linker/LinkArchives.cpp
diff -u llvm/lib/Linker/LinkArchives.cpp:1.48 llvm/lib/Linker/LinkArchives.cpp:1.49
--- llvm/lib/Linker/LinkArchives.cpp:1.48	Tue Mar 15 17:03:34 2005
+++ llvm/lib/Linker/LinkArchives.cpp	Thu Apr 21 17:47:36 2005
@@ -1,10 +1,10 @@
 //===- lib/Linker/LinkArchives.cpp - Link LLVM objects and libraries ------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This file contains routines to handle linking together LLVM bytecode files,
@@ -26,7 +26,7 @@
 /// GetAllDefinedSymbols - Modifies its parameter DefinedSymbols to contain the
 /// name of each externally-visible symbol defined in M.
 ///
-static void 
+static void
 GetAllDefinedSymbols(Module *M, std::set<std::string> &DefinedSymbols) {
   for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
     if (I->hasName() && !I->isExternal() && !I->hasInternalLinkage())
@@ -60,7 +60,7 @@
   Function *Main = M->getMainFunction();
   if (Main == 0 || Main->isExternal())
     UndefinedSymbols.insert("main");
-  
+
   for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
     if (I->hasName()) {
       if (I->isExternal())
@@ -76,7 +76,7 @@
       else if (!I->hasInternalLinkage())
         DefinedSymbols.insert(I->getName());
     }
-  
+
   // Prune out any defined symbols from the undefined symbols set...
   for (std::set<std::string>::iterator I = UndefinedSymbols.begin();
        I != UndefinedSymbols.end(); )
@@ -95,7 +95,7 @@
 /// Return Value:
 ///  TRUE  - An error occurred.
 ///  FALSE - No errors.
-bool 
+bool
 Linker::LinkInArchive(const sys::Path &Filename) {
 
   // Make sure this is an archive file we're dealing with
@@ -110,9 +110,9 @@
   // no reason to link in any archive files.
   std::set<std::string> UndefinedSymbols;
   GetAllUndefinedSymbols(Composite, UndefinedSymbols);
-  
+
   if (UndefinedSymbols.empty()) {
-    verbose("No symbols undefined, skipping library '" + 
+    verbose("No symbols undefined, skipping library '" +
             Filename.toString() + "'");
     return false;  // No need to link anything in!
   }
@@ -124,7 +124,7 @@
   Archive* arch = AutoArch.get();
 
   if (!arch)
-    return error("Cannot read archive '" + Filename.toString() + 
+    return error("Cannot read archive '" + Filename.toString() +
                  "': " + ErrMsg);
 
   // Save a set of symbols that are not defined by the archive. Since we're
@@ -133,13 +133,13 @@
   std::set<std::string> NotDefinedByArchive;
 
   // While we are linking in object files, loop.
-  while (true) {     
+  while (true) {
 
     // Find the modules we need to link into the target module
     std::set<ModuleProvider*> Modules;
     arch->findModulesDefiningSymbols(UndefinedSymbols, Modules);
 
-    // If we didn't find any more modules to link this time, we are done 
+    // If we didn't find any more modules to link this time, we are done
     // searching this archive.
     if (Modules.empty())
       break;
@@ -162,7 +162,7 @@
 
       // Link it in
       if (LinkInModule(aModule))
-        return error("Cannot link in module '" + 
+        return error("Cannot link in module '" +
                      aModule->getModuleIdentifier() + "': " + Error);
     }
 
@@ -171,17 +171,17 @@
     GetAllUndefinedSymbols(Composite, UndefinedSymbols);
 
     // At this point we have two sets of undefined symbols: UndefinedSymbols
-    // which holds the undefined symbols from all the modules, and 
+    // which holds the undefined symbols from all the modules, and
     // NotDefinedByArchive which holds symbols we know the archive doesn't
     // define. There's no point searching for symbols that we won't find in the
     // archive so we subtract these sets.
     set_subtract(UndefinedSymbols, NotDefinedByArchive);
-    
+
     // If there's no symbols left, no point in continuing to search the
     // archive.
     if (UndefinedSymbols.empty())
       break;
   }
-  
+
   return false;
 }


Index: llvm/lib/Linker/LinkItems.cpp
diff -u llvm/lib/Linker/LinkItems.cpp:1.5 llvm/lib/Linker/LinkItems.cpp:1.6
--- llvm/lib/Linker/LinkItems.cpp:1.5	Tue Mar 15 16:55:17 2005
+++ llvm/lib/Linker/LinkItems.cpp	Thu Apr 21 17:47:36 2005
@@ -1,10 +1,10 @@
 //===- lib/Linker/LinkItems.cpp - Link LLVM objects and libraries ---------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Reid Spencer and is distributed under the 
+// This file was developed by Reid Spencer and is distributed under the
 // University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This file contains routines to handle linking together LLVM bytecode files,
@@ -21,7 +21,7 @@
 bool
 Linker::LinkInItems(const ItemList& Items) {
   // For each linkage item ...
-  for (ItemList::const_iterator I = Items.begin(), E = Items.end(); 
+  for (ItemList::const_iterator I = Items.begin(), E = Items.end();
        I != E; ++I) {
     if (I->second) {
       // Link in the library suggested.
@@ -38,7 +38,7 @@
   // that module should also be aggregated with duplicates eliminated. This is
   // now the time to process the dependent libraries to resolve any remaining
   // symbols.
-  for (Module::lib_iterator I = Composite->lib_begin(), 
+  for (Module::lib_iterator I = Composite->lib_begin(),
          E = Composite->lib_end(); I != E; ++I)
     if(LinkInLibrary(*I))
       return true;
@@ -95,9 +95,9 @@
   // now the time to process the dependent libraries to resolve any remaining
   // symbols.
   const Module::LibraryListType& DepLibs = Composite->getLibraries();
-  for (Module::LibraryListType::const_iterator I = DepLibs.begin(), 
-      E = DepLibs.end(); I != E; ++I)
-    if (LinkInLibrary(*I)) 
+  for (Module::LibraryListType::const_iterator I = DepLibs.begin(),
+         E = DepLibs.end(); I != E; ++I)
+    if (LinkInLibrary(*I))
       return true;
 
   return false;
@@ -130,7 +130,7 @@
     verbose("Linking bytecode file '" + File.toString() + "'");
 
     std::auto_ptr<Module> M(LoadObject(File));
-    if (M.get() == 0) 
+    if (M.get() == 0)
       return error("Cannot load file '" + File.toString() + "'" + Error);
     if (LinkInModule(M.get()))
       return error("Cannot link file '" + File.toString() + "'" + Error);


Index: llvm/lib/Linker/LinkModules.cpp
diff -u llvm/lib/Linker/LinkModules.cpp:1.104 llvm/lib/Linker/LinkModules.cpp:1.105
--- llvm/lib/Linker/LinkModules.cpp:1.104	Mon Mar 14 22:54:19 2005
+++ llvm/lib/Linker/LinkModules.cpp	Thu Apr 21 17:47:36 2005
@@ -1,10 +1,10 @@
 //===- lib/Linker/LinkModules.cpp - Module Linker Implementation ----------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
 // This file was developed by the LLVM research group and is distributed under
 // the University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This file implements the LLVM module linker.
@@ -98,11 +98,11 @@
   const Type *SrcTyT = SrcTy.get();
   const Type *DestTyT = DestTy.get();
   if (DestTyT == SrcTyT) return false;       // If already equal, noop
-  
+
   // If we found our opaque type, resolve it now!
   if (isa<OpaqueType>(DestTyT) || isa<OpaqueType>(SrcTyT))
     return ResolveTypes(DestTyT, SrcTyT, DestST, Name);
-  
+
   // Two types cannot be resolved together if they are of different primitive
   // type.  For example, we cannot resolve an int to a float.
   if (DestTyT->getTypeID() != SrcTyT->getTypeID()) return true;
@@ -123,7 +123,7 @@
     return false;
   }
   case Type::StructTyID: {
-    if (getST(DestTy)->getNumContainedTypes() != 
+    if (getST(DestTy)->getNumContainedTypes() !=
         getST(SrcTy)->getNumContainedTypes()) return 1;
     for (unsigned i = 0, e = getST(DestTy)->getNumContainedTypes(); i != e; ++i)
       if (RecursiveResolveTypesI(getST(DestTy)->getContainedType(i),
@@ -159,7 +159,7 @@
     return Result;
   }
   default: assert(0 && "Unexpected type!"); return true;
-  }  
+  }
 }
 
 static bool RecursiveResolveTypes(const PATypeHolder &DestTy,
@@ -229,7 +229,7 @@
         if (!RecursiveResolveTypes(T2, T1, DestST, Name)) {
           // We are making progress!
           DelayedTypesToResolve.erase(DelayedTypesToResolve.begin()+i);
-          
+
           // Go back to the main loop, perhaps we can resolve directly by name
           // now...
           break;
@@ -407,7 +407,7 @@
   } else {
     assert(Dest->hasExternalLinkage() && Src->hasExternalLinkage() &&
            "Unexpected linkage type!");
-    return Error(Err, "Linking globals named '" + Src->getName() + 
+    return Error(Err, "Linking globals named '" + Src->getName() +
                  "': symbol multiply defined!");
   }
   return false;
@@ -423,7 +423,7 @@
   // We will need a module level symbol table if the src module has a module
   // level symbol table...
   SymbolTable *ST = (SymbolTable*)&Dest->getSymbolTable();
-  
+
   // Loop over all of the globals in the src module, mapping them over as we go
   for (Module::global_iterator I = Src->global_begin(), E = Src->global_end(); I != E; ++I) {
     GlobalVariable *SGV = I;
@@ -541,11 +541,11 @@
       Constant *SInit =
         cast<Constant>(RemapOperand(SGV->getInitializer(), ValueMap));
 
-      GlobalVariable *DGV = cast<GlobalVariable>(ValueMap[SGV]);    
+      GlobalVariable *DGV = cast<GlobalVariable>(ValueMap[SGV]);
       if (DGV->hasInitializer()) {
         if (SGV->hasExternalLinkage()) {
           if (DGV->getInitializer() != SInit)
-            return Error(Err, "Global Variable Collision on '" + 
+            return Error(Err, "Global Variable Collision on '" +
                          ToStr(SGV->getType(), Src) +"':%"+SGV->getName()+
                          " - Global variables have different initializers");
         } else if (DGV->hasLinkOnceLinkage() || DGV->hasWeakLinkage()) {
@@ -577,7 +577,7 @@
                              std::map<std::string, GlobalValue*> &GlobalsByName,
                                std::string *Err) {
   SymbolTable *ST = (SymbolTable*)&Dest->getSymbolTable();
-  
+
   // Loop over all of the functions in the src module, mapping them over as we
   // go
   for (Module::const_iterator I = Src->begin(), E = Src->end(); I != E; ++I) {
@@ -637,8 +637,8 @@
                    "' have different linkage specifiers!");
     } else if (SF->hasExternalLinkage()) {
       // The function is defined in both modules!!
-      return Error(Err, "Function '" + 
-                   ToStr(SF->getFunctionType(), Src) + "':\"" + 
+      return Error(Err, "Function '" +
+                   ToStr(SF->getFunctionType(), Src) + "':\"" +
                    SF->getName() + "\" - Function is already defined!");
     } else {
       assert(0 && "Unknown linkage configuration found!");
@@ -718,7 +718,7 @@
                   std::multimap<std::string, GlobalVariable *> &AppendingVars,
                               std::string *ErrorMsg) {
   if (AppendingVars.empty()) return false; // Nothing to do.
-  
+
   // Loop over the multimap of appending vars, processing any variables with the
   // same name, forming a new appending global variable with both of the
   // initializers merged together, then rewrite references to the old variables
@@ -735,7 +735,7 @@
       GlobalVariable *G1 = First->second, *G2 = Second->second;
       const ArrayType *T1 = cast<ArrayType>(G1->getType()->getElementType());
       const ArrayType *T2 = cast<ArrayType>(G2->getType()->getElementType());
-      
+
       // Check to see that they two arrays agree on type...
       if (T1->getElementType() != T2->getElementType())
         return Error(ErrorMsg,
@@ -803,7 +803,7 @@
 // error occurs, true is returned and ErrorMsg (if not null) is set to indicate
 // the problem.  Upon failure, the Dest module could be in a modified state, and
 // shouldn't be relied on to be consistent.
-bool 
+bool
 Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) {
   assert(Dest != 0 && "Invalid Destination module");
   assert(Src  != 0 && "Invalid Source Module");
@@ -824,7 +824,7 @@
   if (!Src->getTargetTriple().empty() &&
       Dest->getTargetTriple() != Src->getTargetTriple())
     std::cerr << "WARNING: Linking two modules of different target triples!\n";
-  
+
   // Update the destination module's dependent libraries list with the libraries
   // from the source module. There's no opportunity for duplicates here as the
   // Module ensures that duplicate insertions are discarded.


Index: llvm/lib/Linker/Linker.cpp
diff -u llvm/lib/Linker/Linker.cpp:1.4 llvm/lib/Linker/Linker.cpp:1.5
--- llvm/lib/Linker/Linker.cpp:1.4	Sat Feb 19 12:30:29 2005
+++ llvm/lib/Linker/Linker.cpp	Thu Apr 21 17:47:36 2005
@@ -1,10 +1,10 @@
 //===- lib/Linker/Linker.cpp - Basic Linker functionality  ----------------===//
-// 
+//
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Reid Spencer and is distributed under the 
+// This file was developed by Reid Spencer and is distributed under the
 // University of Illinois Open Source License. See LICENSE.TXT for details.
-// 
+//
 //===----------------------------------------------------------------------===//
 //
 // This file contains basic Linker functionality that all usages will need.
@@ -42,7 +42,7 @@
   delete Composite;
 }
 
-bool 
+bool
 Linker::error(const std::string& message) {
   Error = message;
   if (!(Flags&QuietErrors)) {
@@ -99,23 +99,23 @@
 }
 
 // LoadObject - Read in and parse the bytecode file named by FN and return the
-// module it contains (wrapped in an auto_ptr), or auto_ptr<Module>() and set 
+// module it contains (wrapped in an auto_ptr), or auto_ptr<Module>() and set
 // Error if an error occurs.
-std::auto_ptr<Module> 
+std::auto_ptr<Module>
 Linker::LoadObject(const sys::Path &FN) {
   std::string ParseErrorMessage;
   Module *Result = ParseBytecodeFile(FN.toString(), &ParseErrorMessage);
-  if (Result) 
+  if (Result)
     return std::auto_ptr<Module>(Result);
   Error = "Bytecode file '" + FN.toString() + "' could not be loaded";
-  if (ParseErrorMessage.size()) 
+  if (ParseErrorMessage.size())
     Error += ": " + ParseErrorMessage;
   return std::auto_ptr<Module>();
 }
 
-// IsLibrary - Determine if "Name" is a library in "Directory". Return 
+// 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) {
 
   assert(Directory.isDirectory() && "Need to specify a directory");
@@ -145,15 +145,15 @@
 /// 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
 /// Filename, then libFilename.[suffix] for each of a set of several common
-/// library suffixes, in each of the directories in LibPaths. Returns an empty 
+/// library suffixes, in each of the directories in LibPaths. Returns an empty
 /// Path if no matching file can be found.
 ///
-sys::Path 
-Linker::FindLib(const std::string &Filename) 
+sys::Path
+Linker::FindLib(const std::string &Filename)
 {
   // Determine if the pathname can be found as it stands.
   sys::Path FilePath(Filename);
-  if (FilePath.readable() && 
+  if (FilePath.readable() &&
       (FilePath.isArchive() || FilePath.isDynamicLibrary()))
     return FilePath;
 






More information about the llvm-commits mailing list