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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33663 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ARM/ARMAsmPrinter.cpp b/lib/Target/ARM/ARMAsmPrinter.cpp
index 0412bc5..dee4640 100644
--- a/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -264,7 +264,7 @@
     bool isCallOp = Modifier && !strcmp(Modifier, "call");
     GlobalValue *GV = MO.getGlobal();
     std::string Name = Mang->getValueName(GV);
-    bool isExt = (GV->isExternal() || GV->hasWeakLinkage() ||
+    bool isExt = (GV->isDeclaration() || GV->hasWeakLinkage() ||
                   GV->hasLinkOnceLinkage());
     if (isExt && isCallOp && Subtarget->isTargetDarwin() &&
         TM.getRelocationModel() != Reloc::Static) {
diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp
index 55b22aa..24357cf 100644
--- a/lib/Target/ARM/ARMISelLowering.cpp
+++ b/lib/Target/ARM/ARMISelLowering.cpp
@@ -467,7 +467,7 @@
     GlobalValue *GV = G->getGlobal();
     Callee = DAG.getTargetGlobalAddress(GV, getPointerTy());
     isDirect = true;
-    bool isExt = (GV->isExternal() || GV->hasWeakLinkage() ||
+    bool isExt = (GV->isDeclaration() || GV->hasWeakLinkage() ||
                   GV->hasLinkOnceLinkage());
     bool isStub = (isExt && Subtarget->isTargetDarwin()) &&
                    getTargetMachine().getRelocationModel() != Reloc::Static;
@@ -632,7 +632,7 @@
 /// even in dynamic-no-pic mode.
 static bool GVIsIndirectSymbol(GlobalValue *GV) {
   return (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
-          (GV->isExternal() && !GV->hasNotBeenReadFromBytecode()));
+          (GV->isDeclaration() && !GV->hasNotBeenReadFromBytecode()));
 }
 
 SDOperand ARMTargetLowering::LowerGlobalAddress(SDOperand Op,
diff --git a/lib/Target/Alpha/AlphaISelLowering.cpp b/lib/Target/Alpha/AlphaISelLowering.cpp
index 7df996d..0d1cacf 100644
--- a/lib/Target/Alpha/AlphaISelLowering.cpp
+++ b/lib/Target/Alpha/AlphaISelLowering.cpp
@@ -427,7 +427,7 @@
     GlobalValue *GV = GSDN->getGlobal();
     SDOperand GA = DAG.getTargetGlobalAddress(GV, MVT::i64, GSDN->getOffset());
 
-    //    if (!GV->hasWeakLinkage() && !GV->isExternal() && !GV->hasLinkOnceLinkage()) {
+    //    if (!GV->hasWeakLinkage() && !GV->isDeclaration() && !GV->hasLinkOnceLinkage()) {
     if (GV->hasInternalLinkage()) {
       SDOperand Hi = DAG.getNode(AlphaISD::GPRelHi,  MVT::i64, GA,
 				 DAG.getNode(ISD::GLOBAL_OFFSET_TABLE, MVT::i64));
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index a6d3fb5..785e764 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -305,7 +305,7 @@
   std::map<std::string, GlobalValue*> ExtSymbols;
   for (Module::iterator I = M.begin(), E = M.end(); I != E;) {
     Function *GV = I++;
-    if (GV->isExternal() && GV->hasName()) {
+    if (GV->isDeclaration() && GV->hasName()) {
       std::pair<std::map<std::string, GlobalValue*>::iterator, bool> X
         = ExtSymbols.insert(std::make_pair(GV->getName(), GV));
       if (!X.second) {
@@ -321,7 +321,7 @@
   for (Module::global_iterator I = M.global_begin(), E = M.global_end();
        I != E;) {
     GlobalVariable *GV = I++;
-    if (GV->isExternal() && GV->hasName()) {
+    if (GV->isDeclaration() && GV->hasName()) {
       std::pair<std::map<std::string, GlobalValue*>::iterator, bool> X
         = ExtSymbols.insert(std::make_pair(GV->getName(), GV));
       if (!X.second) {
@@ -1525,7 +1525,7 @@
     Out << "\n\n/* Global Variable Declarations */\n";
     for (Module::global_iterator I = M.global_begin(), E = M.global_end();
          I != E; ++I)
-      if (!I->isExternal()) {
+      if (!I->isDeclaration()) {
         // Ignore special globals, such as debug info.
         if (getGlobalVariableClass(I))
           continue;
@@ -1554,7 +1554,7 @@
     Out << "\n\n/* Global Variable Definitions and Initialization */\n";
     for (Module::global_iterator I = M.global_begin(), E = M.global_end(); 
          I != E; ++I)
-      if (!I->isExternal()) {
+      if (!I->isDeclaration()) {
         // Ignore special globals, such as debug info.
         if (getGlobalVariableClass(I))
           continue;
@@ -1777,7 +1777,7 @@
   FunctionInnards << Mang->getValueName(F) << '(';
 
   bool PrintedArg = false;
-  if (!F->isExternal()) {
+  if (!F->isDeclaration()) {
     if (!F->arg_empty()) {
       Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
       
diff --git a/lib/Target/IA64/IA64AsmPrinter.cpp b/lib/Target/IA64/IA64AsmPrinter.cpp
index 2adb53e..d576c4c 100644
--- a/lib/Target/IA64/IA64AsmPrinter.cpp
+++ b/lib/Target/IA64/IA64AsmPrinter.cpp
@@ -193,17 +193,17 @@
     bool Needfptr=false; // if we're computing an address @ltoff(X), do
                          // we need to decorate it so it becomes
                          // @ltoff(@fptr(X)) ?
-    if (F && !isBRCALLinsn /*&& F->isExternal()*/)
+    if (F && !isBRCALLinsn /*&& F->isDeclaration()*/)
       Needfptr=true;
 
     // if this is the target of a call instruction, we should define
     // the function somewhere (GNU gas has no problem without this, but
     // Intel ias rightly complains of an 'undefined symbol')
 
-    if (F /*&& isBRCALLinsn*/ && F->isExternal())
+    if (F /*&& isBRCALLinsn*/ && F->isDeclaration())
       ExternalFunctionNames.insert(Mang->getValueName(MO.getGlobal()));
     else
-      if (GV->isExternal()) // e.g. stuff like 'stdin'
+      if (GV->isDeclaration()) // e.g. stuff like 'stdin'
         ExternalObjectNames.insert(Mang->getValueName(MO.getGlobal()));
 
     if (!isBRCALLinsn)
diff --git a/lib/Target/PowerPC/PPCAsmPrinter.cpp b/lib/Target/PowerPC/PPCAsmPrinter.cpp
index 7126af2..efd6d10 100644
--- a/lib/Target/PowerPC/PPCAsmPrinter.cpp
+++ b/lib/Target/PowerPC/PPCAsmPrinter.cpp
@@ -183,7 +183,7 @@
       if (TM.getRelocationModel() != Reloc::Static) {
         if (MO.getType() == MachineOperand::MO_GlobalAddress) {
           GlobalValue *GV = MO.getGlobal();
-          if (((GV->isExternal() || GV->hasWeakLinkage() ||
+          if (((GV->isDeclaration() || GV->hasWeakLinkage() ||
                 GV->hasLinkOnceLinkage()))) {
             // Dynamically-resolved functions need a stub for the function.
             std::string Name = Mang->getValueName(GV);
@@ -381,7 +381,7 @@
 
     // External or weakly linked global variables need non-lazily-resolved stubs
     if (TM.getRelocationModel() != Reloc::Static) {
-      if (((GV->isExternal() || GV->hasWeakLinkage() ||
+      if (((GV->isDeclaration() || GV->hasWeakLinkage() ||
             GV->hasLinkOnceLinkage()))) {
         GVStubs.insert(Name);
         O << "L" << Name << "$non_lazy_ptr";
diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp
index 235b9d5..62f8995 100644
--- a/lib/Target/PowerPC/PPCSubtarget.cpp
+++ b/lib/Target/PowerPC/PPCSubtarget.cpp
@@ -137,5 +137,5 @@
     return false;
   
   return GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
-         (GV->isExternal() && !GV->hasNotBeenReadFromBytecode());
+         (GV->isDeclaration() && !GV->hasNotBeenReadFromBytecode());
 }
diff --git a/lib/Target/X86/X86ATTAsmPrinter.cpp b/lib/Target/X86/X86ATTAsmPrinter.cpp
index 92abfc5..91b22d1 100755
--- a/lib/Target/X86/X86ATTAsmPrinter.cpp
+++ b/lib/Target/X86/X86ATTAsmPrinter.cpp
@@ -281,7 +281,7 @@
     if (printStub(TM, Subtarget)) {
       // Link-once, External, or Weakly-linked global variables need
       // non-lazily-resolved stubs
-      if (GV->isExternal() ||
+      if (GV->isDeclaration() ||
           GV->hasWeakLinkage() ||
           GV->hasLinkOnceLinkage()) {
         // Dynamically-resolved functions need a stub for the function.
@@ -310,10 +310,10 @@
       if (isCallOp && isa<Function>(GV)) {
         if (printGOT(TM, Subtarget)) {
           // Assemble call via PLT for non-local symbols
-          if (!GV->hasHiddenVisibility() || GV->isExternal())
+          if (!GV->hasHiddenVisibility() || GV->isDeclaration())
             O << "@PLT";
         }
-        if (Subtarget->isTargetCygMing() && GV->isExternal())
+        if (Subtarget->isTargetCygMing() && GV->isDeclaration())
           // Save function name for later type emission
           FnStubs.insert(Name);
       }
diff --git a/lib/Target/X86/X86IntelAsmPrinter.cpp b/lib/Target/X86/X86IntelAsmPrinter.cpp
index 66a2a49..946840e 100755
--- a/lib/Target/X86/X86IntelAsmPrinter.cpp
+++ b/lib/Target/X86/X86IntelAsmPrinter.cpp
@@ -347,7 +347,7 @@
 
   // Emit declarations for external functions.
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
-    if (I->isExternal()) {
+    if (I->isDeclaration()) {
       std::string Name = Mang->getValueName(I);
       X86SharedAsmPrinter::decorateName(Name, I);
 
@@ -362,7 +362,7 @@
   // external globals to have type byte, and if that's good enough for VC++...
   for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
        I != E; ++I) {
-    if (I->isExternal()) {
+    if (I->isDeclaration()) {
       std::string Name = Mang->getValueName(I);
 
       O << "\textern " ;
@@ -382,7 +382,7 @@
   // Print out module-level global variables here.
   for (Module::const_global_iterator I = M.global_begin(), E = M.global_end();
        I != E; ++I) {
-    if (I->isExternal()) continue;   // External global require no code
+    if (I->isDeclaration()) continue;   // External global require no code
     
     // Check to see if this is a special global used by LLVM, if so, emit it.
     if (EmitSpecialLLVMGlobal(I))
diff --git a/lib/Target/X86/X86Subtarget.cpp b/lib/Target/X86/X86Subtarget.cpp
index 50746d7..89f69d9 100644
--- a/lib/Target/X86/X86Subtarget.cpp
+++ b/lib/Target/X86/X86Subtarget.cpp
@@ -40,11 +40,11 @@
     if (isTargetDarwin()) {
       return (!isDirectCall &&
               (GV->hasWeakLinkage() || GV->hasLinkOnceLinkage() ||
-               (GV->isExternal() && !GV->hasNotBeenReadFromBytecode())));
+               (GV->isDeclaration() && !GV->hasNotBeenReadFromBytecode())));
     } else if (TM.getRelocationModel() == Reloc::PIC_ && isPICStyleGOT()) {
       // Extra load is needed for all non-statics.
       return (!isDirectCall &&
-              (GV->isExternal() || !GV->hasInternalLinkage()));
+              (GV->isDeclaration() || !GV->hasInternalLinkage()));
     } else if (isTargetCygMing() || isTargetWindows()) {
       return (GV->hasDLLImportLinkage());
     }