diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bugpoint/CrashDebugger.cpp | 6 | ||||
-rw-r--r-- | tools/bugpoint/ExtractFunction.cpp | 6 | ||||
-rw-r--r-- | tools/bugpoint/Miscompilation.cpp | 12 | ||||
-rw-r--r-- | tools/llc/llc.cpp | 2 | ||||
-rw-r--r-- | tools/llvm-nm/llvm-nm.cpp | 2 | ||||
-rw-r--r-- | tools/llvm-upgrade/UpgradeParser.cpp.cvs | 4 | ||||
-rw-r--r-- | tools/llvm-upgrade/UpgradeParser.y | 4 | ||||
-rw-r--r-- | tools/llvm-upgrade/UpgradeParser.y.cvs | 4 | ||||
-rw-r--r-- | tools/llvm2cpp/CppWriter.cpp | 8 | ||||
-rw-r--r-- | tools/lto/lto.cpp | 6 | ||||
-rw-r--r-- | tools/opt/AnalysisWrappers.cpp | 2 |
11 files changed, 28 insertions, 28 deletions
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp index 23aad53adf..66b6511067 100644 --- a/tools/bugpoint/CrashDebugger.cpp +++ b/tools/bugpoint/CrashDebugger.cpp @@ -219,7 +219,7 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector<Function*> &Funcs) { // Loop over and delete any functions which we aren't supposed to be playing // with... for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) - if (!I->isExternal() && !Functions.count(I)) + if (!I->isDeclaration() && !Functions.count(I)) DeleteFunctionBody(I); // Try running the hacked up program... @@ -406,7 +406,7 @@ static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *)) { std::vector<Function*> Functions; for (Module::iterator I = BD.getProgram()->begin(), E = BD.getProgram()->end(); I != E; ++I) - if (!I->isExternal()) + if (!I->isDeclaration()) Functions.push_back(I); if (Functions.size() > 1 && !BugpointIsInterrupted) { @@ -459,7 +459,7 @@ static bool DebugACrash(BugDriver &BD, bool (*TestFn)(BugDriver &, Module *)) { unsigned CurInstructionNum = 0; for (Module::const_iterator FI = BD.getProgram()->begin(), E = BD.getProgram()->end(); FI != E; ++FI) - if (!FI->isExternal()) + if (!FI->isDeclaration()) for (Function::const_iterator BI = FI->begin(), E = FI->end(); BI != E; ++BI) for (BasicBlock::const_iterator I = BI->begin(), E = --BI->end(); diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp index 34fa727f0e..b9d43e8971 100644 --- a/tools/bugpoint/ExtractFunction.cpp +++ b/tools/bugpoint/ExtractFunction.cpp @@ -170,7 +170,7 @@ Module *BugDriver::ExtractLoop(Module *M) { void llvm::DeleteFunctionBody(Function *F) { // delete the body of the function... F->deleteBody(); - assert(F->isExternal() && "This didn't make the function external!"); + assert(F->isDeclaration() && "This didn't make the function external!"); } /// GetTorInit - Given a list of entries for static ctors/dtors, return them @@ -195,7 +195,7 @@ static Constant *GetTorInit(std::vector<std::pair<Function*, int> > &TorList) { /// prune appropriate entries out of M1s list. static void SplitStaticCtorDtor(const char *GlobalName, Module *M1, Module *M2){ GlobalVariable *GV = M1->getNamedGlobal(GlobalName); - if (!GV || GV->isExternal() || GV->hasInternalLinkage() || + if (!GV || GV->isDeclaration() || GV->hasInternalLinkage() || !GV->use_empty()) return; std::vector<std::pair<Function*, int> > M1Tors, M2Tors; @@ -217,7 +217,7 @@ static void SplitStaticCtorDtor(const char *GlobalName, Module *M1, Module *M2){ if (CE->isCast()) FP = CE->getOperand(0); if (Function *F = dyn_cast<Function>(FP)) { - if (!F->isExternal()) + if (!F->isDeclaration()) M1Tors.push_back(std::make_pair(F, Priority)); else { // Map to M2's version of the function. diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp index 4c2e473e19..bdbd11ba15 100644 --- a/tools/bugpoint/Miscompilation.cpp +++ b/tools/bugpoint/Miscompilation.cpp @@ -320,7 +320,7 @@ static bool ExtractLoops(BugDriver &BD, std::vector<std::pair<std::string, const FunctionType*> > MisCompFunctions; for (Module::iterator I = ToOptimizeLoopExtracted->begin(), E = ToOptimizeLoopExtracted->end(); I != E; ++I) - if (!I->isExternal()) + if (!I->isDeclaration()) MisCompFunctions.push_back(std::make_pair(I->getName(), I->getFunctionType())); @@ -460,7 +460,7 @@ static bool ExtractBlocks(BugDriver &BD, std::vector<std::pair<std::string, const FunctionType*> > MisCompFunctions; for (Module::iterator I = Extracted->begin(), E = Extracted->end(); I != E; ++I) - if (!I->isExternal()) + if (!I->isDeclaration()) MisCompFunctions.push_back(std::make_pair(I->getName(), I->getFunctionType())); @@ -502,7 +502,7 @@ DebugAMiscompilation(BugDriver &BD, std::vector<Function*> MiscompiledFunctions; Module *Prog = BD.getProgram(); for (Module::iterator I = Prog->begin(), E = Prog->end(); I != E; ++I) - if (!I->isExternal()) + if (!I->isDeclaration()) MiscompiledFunctions.push_back(I); // Do the reduction... @@ -637,7 +637,7 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // the Test module to call into it. Thus, we create a new function `main' // which just calls the old one. if (Function *oldMain = Safe->getNamedFunction("main")) - if (!oldMain->isExternal()) { + if (!oldMain->isDeclaration()) { // Rename it oldMain->setName("llvm_bugpoint_old_main"); // Create a NEW `main' function with same type in the test module. @@ -680,12 +680,12 @@ static void CleanupAndPrepareModules(BugDriver &BD, Module *&Test, // Use the function we just added to get addresses of functions we need. for (Module::iterator F = Safe->begin(), E = Safe->end(); F != E; ++F) { - if (F->isExternal() && !F->use_empty() && &*F != resolverFunc && + if (F->isDeclaration() && !F->use_empty() && &*F != resolverFunc && F->getIntrinsicID() == 0 /* ignore intrinsics */) { Function *TestFn = Test->getNamedFunction(F->getName()); // Don't forward functions which are external in the test module too. - if (TestFn && !TestFn->isExternal()) { + if (TestFn && !TestFn->isDeclaration()) { // 1. Add a string constant with its name to the global file Constant *InitArray = ConstantArray::get(F->getName()); GlobalVariable *funcName = diff --git a/tools/llc/llc.cpp b/tools/llc/llc.cpp index fd7afa9d1f..200b1475a3 100644 --- a/tools/llc/llc.cpp +++ b/tools/llc/llc.cpp @@ -260,7 +260,7 @@ int main(int argc, char **argv) { // Run our queue of passes all at once now, efficiently. // TODO: this could lazily stream functions out of the module. for (Module::iterator I = mod.begin(), E = mod.end(); I != E; ++I) - if (!I->isExternal()) + if (!I->isDeclaration()) Passes.run(*I); Passes.doFinalization(); diff --git a/tools/llvm-nm/llvm-nm.cpp b/tools/llvm-nm/llvm-nm.cpp index 422cdda874..2d80f531ed 100644 --- a/tools/llvm-nm/llvm-nm.cpp +++ b/tools/llvm-nm/llvm-nm.cpp @@ -67,7 +67,7 @@ namespace { } static char TypeCharForSymbol(GlobalValue &GV) { - if (GV.isExternal()) return 'U'; + if (GV.isDeclaration()) return 'U'; if (GV.hasLinkOnceLinkage()) return 'C'; if (GV.hasWeakLinkage()) return 'W'; if (isa<Function>(GV) && GV.hasInternalLinkage()) return 't'; diff --git a/tools/llvm-upgrade/UpgradeParser.cpp.cvs b/tools/llvm-upgrade/UpgradeParser.cpp.cvs index 3ac45504cb..515d2d6bab 100644 --- a/tools/llvm-upgrade/UpgradeParser.cpp.cvs +++ b/tools/llvm-upgrade/UpgradeParser.cpp.cvs @@ -5113,11 +5113,11 @@ yyreduce: (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { // If this is the case, either we need to be a forward decl, or it needs // to be. - if (!CurFun.isDeclare && !Fn->isExternal()) + if (!CurFun.isDeclare && !Fn->isDeclaration()) error("Redefinition of function '" + FunctionName + "'"); // Make sure to strip off any argument names so we can't get conflicts. - if (Fn->isExternal()) + if (Fn->isDeclaration()) for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); AI != AE; ++AI) AI->setName(""); diff --git a/tools/llvm-upgrade/UpgradeParser.y b/tools/llvm-upgrade/UpgradeParser.y index a5079d43e1..cb02675e48 100644 --- a/tools/llvm-upgrade/UpgradeParser.y +++ b/tools/llvm-upgrade/UpgradeParser.y @@ -2619,11 +2619,11 @@ FunctionHeaderH (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { // If this is the case, either we need to be a forward decl, or it needs // to be. - if (!CurFun.isDeclare && !Fn->isExternal()) + if (!CurFun.isDeclare && !Fn->isDeclaration()) error("Redefinition of function '" + FunctionName + "'"); // Make sure to strip off any argument names so we can't get conflicts. - if (Fn->isExternal()) + if (Fn->isDeclaration()) for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); AI != AE; ++AI) AI->setName(""); diff --git a/tools/llvm-upgrade/UpgradeParser.y.cvs b/tools/llvm-upgrade/UpgradeParser.y.cvs index a5079d43e1..cb02675e48 100644 --- a/tools/llvm-upgrade/UpgradeParser.y.cvs +++ b/tools/llvm-upgrade/UpgradeParser.y.cvs @@ -2619,11 +2619,11 @@ FunctionHeaderH (Fn = CurModule.CurrentModule->getFunction(FunctionName, FT))) { // If this is the case, either we need to be a forward decl, or it needs // to be. - if (!CurFun.isDeclare && !Fn->isExternal()) + if (!CurFun.isDeclare && !Fn->isDeclaration()) error("Redefinition of function '" + FunctionName + "'"); // Make sure to strip off any argument names so we can't get conflicts. - if (Fn->isExternal()) + if (Fn->isDeclaration()) for (Function::arg_iterator AI = Fn->arg_begin(), AE = Fn->arg_end(); AI != AE; ++AI) AI->setName(""); diff --git a/tools/llvm2cpp/CppWriter.cpp b/tools/llvm2cpp/CppWriter.cpp index 9fec9c1ba1..d0a02bfa0e 100644 --- a/tools/llvm2cpp/CppWriter.cpp +++ b/tools/llvm2cpp/CppWriter.cpp @@ -1452,7 +1452,7 @@ void CppWriter::printFunctionHead(const Function* F) { Out << ","; nl(Out) << "/*Name=*/\""; printEscapedString(F->getName()); - Out << "\", mod); " << (F->isExternal()? "// (external, no body)" : ""); + Out << "\", mod); " << (F->isDeclaration()? "// (external, no body)" : ""); nl(Out,-1); printCppName(F); Out << "->setCallingConv("; @@ -1476,7 +1476,7 @@ void CppWriter::printFunctionHead(const Function* F) { } void CppWriter::printFunctionBody(const Function *F) { - if (F->isExternal()) + if (F->isDeclaration()) return; // external functions have no bodies. // Clear the DefinedValues and ForwardRefs maps because we can't have @@ -1550,7 +1550,7 @@ void CppWriter::printInline(const std::string& fname, const std::string& func) { error(std::string("Function '") + func + "' not found in input module"); return; } - if (F->isExternal()) { + if (F->isDeclaration()) { error(std::string("Function '") + func + "' is external!"); return; } @@ -1611,7 +1611,7 @@ void CppWriter::printModuleBody() { nl(Out) << "// Function Definitions"; nl(Out); for (Module::const_iterator I = TheModule->begin(), E = TheModule->end(); I != E; ++I) { - if (!I->isExternal()) { + if (!I->isDeclaration()) { nl(Out) << "// Function: " << I->getName() << " (" << getCppName(I) << ")"; nl(Out) << "{"; diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index 38f01a004a..d280f23940 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -164,7 +164,7 @@ LTO::readLLVMObjectFile(const std::string &InputFilename, LTOLinkageTypes lt = getLTOLinkageType(f); - if (!f->isExternal() && lt != LTOInternalLinkage + if (!f->isDeclaration() && lt != LTOInternalLinkage && strncmp (f->getName().c_str(), "llvm.", 5)) { int alignment = ( 16 > f->getAlignment() ? 16 : f->getAlignment()); LLVMSymbol *newSymbol = new LLVMSymbol(lt, f, f->getName(), @@ -186,7 +186,7 @@ LTO::readLLVMObjectFile(const std::string &InputFilename, for (Module::global_iterator v = m->global_begin(), e = m->global_end(); v != e; ++v) { LTOLinkageTypes lt = getLTOLinkageType(v); - if (!v->isExternal() && lt != LTOInternalLinkage + if (!v->isDeclaration() && lt != LTOInternalLinkage && strncmp (v->getName().c_str(), "llvm.", 5)) { const TargetData *TD = Target->getTargetData(); LLVMSymbol *newSymbol = new LLVMSymbol(lt, v, v->getName(), @@ -324,7 +324,7 @@ LTO::optimize(Module *M, std::ostream &Out, // Run the code generator, if present. CodeGenPasses->doInitialization(); for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) { - if (!I->isExternal()) + if (!I->isDeclaration()) CodeGenPasses->run(*I); } CodeGenPasses->doFinalization(); diff --git a/tools/opt/AnalysisWrappers.cpp b/tools/opt/AnalysisWrappers.cpp index 728b218fe5..3223b82030 100644 --- a/tools/opt/AnalysisWrappers.cpp +++ b/tools/opt/AnalysisWrappers.cpp @@ -32,7 +32,7 @@ namespace { struct ExternalFunctionsPassedConstants : public ModulePass { virtual bool runOnModule(Module &M) { for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I) - if (I->isExternal()) { + if (I->isDeclaration()) { bool PrintedFn = false; for (Value::use_iterator UI = I->use_begin(), E = I->use_end(); UI != E; ++UI) |