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

Reid Spencer reid at x10sys.com
Tue Jan 30 12:10:09 PST 2007



Changes in directory llvm/lib/Linker:

LinkArchives.cpp updated: 1.54 -> 1.55
LinkModules.cpp updated: 1.129 -> 1.130
---
Log message:

For PR1136: http://llvm.org/PR1136 : Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.


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

 LinkArchives.cpp |    6 +++---
 LinkModules.cpp  |   20 ++++++++++----------
 2 files changed, 13 insertions(+), 13 deletions(-)


Index: llvm/lib/Linker/LinkArchives.cpp
diff -u llvm/lib/Linker/LinkArchives.cpp:1.54 llvm/lib/Linker/LinkArchives.cpp:1.55
--- llvm/lib/Linker/LinkArchives.cpp:1.54	Sat Nov 11 14:27:49 2006
+++ llvm/lib/Linker/LinkArchives.cpp	Tue Jan 30 14:08:37 2007
@@ -44,12 +44,12 @@
   // This is needed for programs where the main function is defined in an
   // archive, such f2c'd programs.
   Function *Main = M->getMainFunction();
-  if (Main == 0 || Main->isExternal())
+  if (Main == 0 || Main->isDeclaration())
     UndefinedSymbols.insert("main");
 
   for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
     if (I->hasName()) {
-      if (I->isExternal())
+      if (I->isDeclaration())
         UndefinedSymbols.insert(I->getName());
       else if (!I->hasInternalLinkage()) {
         assert(!I->hasDLLImportLinkage()
@@ -60,7 +60,7 @@
   for (Module::global_iterator I = M->global_begin(), E = M->global_end();
        I != E; ++I)
     if (I->hasName()) {
-      if (I->isExternal())
+      if (I->isDeclaration())
         UndefinedSymbols.insert(I->getName());
       else if (!I->hasInternalLinkage()) {
         assert(!I->hasDLLImportLinkage()


Index: llvm/lib/Linker/LinkModules.cpp
diff -u llvm/lib/Linker/LinkModules.cpp:1.129 llvm/lib/Linker/LinkModules.cpp:1.130
--- llvm/lib/Linker/LinkModules.cpp:1.129	Sun Jan 28 20:18:13 2007
+++ llvm/lib/Linker/LinkModules.cpp	Tue Jan 30 14:08:37 2007
@@ -365,12 +365,12 @@
     // Linking something to nothing.
     LinkFromSrc = true;
     LT = Src->getLinkage();
-  } else if (Src->isExternal()) {
+  } else if (Src->isDeclaration()) {
     // If Src is external or if both Src & Drc are external..  Just link the
     // external globals, we aren't adding anything.
     if (Src->hasDLLImportLinkage()) {
       // If one of GVs has DLLImport linkage, result should be dllimport'ed.
-      if (Dest->isExternal()) {
+      if (Dest->isDeclaration()) {
         LinkFromSrc = true;
         LT = Src->getLinkage();
       }      
@@ -382,7 +382,7 @@
       LinkFromSrc = false;
       LT = Dest->getLinkage();
     }
-  } else if (Dest->isExternal() && !Dest->hasDLLImportLinkage()) {
+  } else if (Dest->isDeclaration() && !Dest->hasDLLImportLinkage()) {
     // If Dest is external but Src is not:
     LinkFromSrc = true;
     LT = Src->getLinkage();
@@ -536,7 +536,7 @@
         DGV->setInitializer(0);
       } else {
         if (SGV->isConstant() && !DGV->isConstant()) {
-          if (DGV->isExternal())
+          if (DGV->isDeclaration())
             DGV->setConstant(true);
         }
         SGV->setLinkage(GlobalValue::ExternalLinkage);
@@ -637,18 +637,18 @@
 
       // ... and remember this mapping...
       ValueMap.insert(std::make_pair(SF, NewDF));
-    } else if (SF->isExternal()) {
+    } else if (SF->isDeclaration()) {
       // If SF is external or if both SF & DF are external..  Just link the
       // external functions, we aren't adding anything.
       if (SF->hasDLLImportLinkage()) {
-        if (DF->isExternal()) {
+        if (DF->isDeclaration()) {
           ValueMap.insert(std::make_pair(SF, DF));
           DF->setLinkage(SF->getLinkage());          
         }        
       } else {
         ValueMap.insert(std::make_pair(SF, DF));
       }      
-    } else if (DF->isExternal() && !DF->hasDLLImportLinkage()) {
+    } else if (DF->isDeclaration() && !DF->hasDLLImportLinkage()) {
       // If DF is external but SF is not...
       // Link the external functions, update linkage qualifiers
       ValueMap.insert(std::make_pair(SF, DF));
@@ -691,7 +691,7 @@
 static bool LinkFunctionBody(Function *Dest, Function *Src,
                              std::map<const Value*, Value*> &GlobalMap,
                              std::string *Err) {
-  assert(Src && Dest && Dest->isExternal() && !Src->isExternal());
+  assert(Src && Dest && Dest->isDeclaration() && !Src->isDeclaration());
 
   // Go through and convert function arguments over, remembering the mapping.
   Function::arg_iterator DI = Dest->arg_begin();
@@ -737,11 +737,11 @@
   // Loop over all of the functions in the src module, mapping them over as we
   // go
   for (Module::iterator SF = Src->begin(), E = Src->end(); SF != E; ++SF) {
-    if (!SF->isExternal()) {                  // No body if function is external
+    if (!SF->isDeclaration()) {                  // No body if function is external
       Function *DF = cast<Function>(ValueMap[SF]); // Destination function
 
       // DF not external SF external?
-      if (DF->isExternal()) {
+      if (DF->isDeclaration()) {
         // Only provide the function body if there isn't one already.
         if (LinkFunctionBody(DF, SF, ValueMap, Err))
           return true;






More information about the llvm-commits mailing list