For PR411:
Adjust to changes in Module interface:
getMainFunction() -> getFunction("main")
getNamedFunction(X) -> getFunction(X)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33922 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp
index b597d82..5596839 100644
--- a/tools/bugpoint/CrashDebugger.cpp
+++ b/tools/bugpoint/CrashDebugger.cpp
@@ -194,7 +194,7 @@
//if main isn't present, claim there is no problem
if (KeepMain && find(Funcs.begin(), Funcs.end(),
- BD.getProgram()->getMainFunction()) == Funcs.end())
+ BD.getProgram()->getFunction("main")) == Funcs.end())
return false;
// Clone the program to try hacking it apart...
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp
index 38ccf0b..aed90cb 100644
--- a/tools/bugpoint/Miscompilation.cpp
+++ b/tools/bugpoint/Miscompilation.cpp
@@ -639,7 +639,7 @@
// First, if the main function is in the Safe module, we must add a stub to
// 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 (Function *oldMain = Safe->getFunction("main"))
if (!oldMain->isDeclaration()) {
// Rename it
oldMain->setName("llvm_bugpoint_old_main");
@@ -685,7 +685,7 @@
for (Module::iterator F = Safe->begin(), E = Safe->end(); F != E; ++F) {
if (F->isDeclaration() && !F->use_empty() && &*F != resolverFunc &&
F->getIntrinsicID() == 0 /* ignore intrinsics */) {
- Function *TestFn = Test->getNamedFunction(F->getName());
+ Function *TestFn = Test->getFunction(F->getName());
// Don't forward functions which are external in the test module too.
if (TestFn && !TestFn->isDeclaration()) {
diff --git a/tools/lli/lli.cpp b/tools/lli/lli.cpp
index 9f1ecc2..c7b0765 100644
--- a/tools/lli/lli.cpp
+++ b/tools/lli/lli.cpp
@@ -103,7 +103,7 @@
// using the contents of Args to determine argc & argv, and the contents of
// EnvVars to determine envp.
//
- Function *Fn = MP->getModule()->getMainFunction();
+ Function *Fn = MP->getModule()->getFunction("main");
if (!Fn) {
std::cerr << "'main' function not found in module.\n";
return -1;
diff --git a/tools/llvm-upgrade/UpgradeParser.cpp.cvs b/tools/llvm-upgrade/UpgradeParser.cpp.cvs
index 70ff399..cee36df 100644
--- a/tools/llvm-upgrade/UpgradeParser.cpp.cvs
+++ b/tools/llvm-upgrade/UpgradeParser.cpp.cvs
@@ -929,7 +929,7 @@
if (const FunctionType *FTy =
dyn_cast<FunctionType>(PTy->getElementType()))
if (Function *OtherF =
- CurModule.CurrentModule->getNamedFunction(DID.getName()))
+ CurModule.CurrentModule->getFunction(DID.getName()))
if (FuncTysDifferOnlyBySRet(FTy,OtherF->getFunctionType())) {
V->replaceAllUsesWith(ConstantExpr::getBitCast(OtherF, PTy));
fixed = true;
@@ -1677,10 +1677,10 @@
//Not all functions use vaarg, so make a second check for ObsoleteVarArgs
{
Function* F;
- if ((F = Result->getNamedFunction("llvm.va_start"))
+ if ((F = Result->getFunction("llvm.va_start"))
&& F->getFunctionType()->getNumParams() == 0)
ObsoleteVarArgs = true;
- if((F = Result->getNamedFunction("llvm.va_copy"))
+ if((F = Result->getFunction("llvm.va_copy"))
&& F->getFunctionType()->getNumParams() == 1)
ObsoleteVarArgs = true;
}
@@ -1691,7 +1691,7 @@
}
if(ObsoleteVarArgs) {
- if(Function* F = Result->getNamedFunction("llvm.va_start")) {
+ if(Function* F = Result->getFunction("llvm.va_start")) {
if (F->arg_size() != 0) {
error("Obsolete va_start takes 0 argument");
return 0;
@@ -1720,7 +1720,7 @@
Result->getFunctionList().erase(F);
}
- if(Function* F = Result->getNamedFunction("llvm.va_end")) {
+ if(Function* F = Result->getFunction("llvm.va_end")) {
if(F->arg_size() != 1) {
error("Obsolete va_end takes 1 argument");
return 0;
@@ -1746,7 +1746,7 @@
Result->getFunctionList().erase(F);
}
- if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
+ if(Function* F = Result->getFunction("llvm.va_copy")) {
if(F->arg_size() != 1) {
error("Obsolete va_copy takes 1 argument");
return 0;
diff --git a/tools/llvm-upgrade/UpgradeParser.y b/tools/llvm-upgrade/UpgradeParser.y
index 0f47b38..3091ea3 100644
--- a/tools/llvm-upgrade/UpgradeParser.y
+++ b/tools/llvm-upgrade/UpgradeParser.y
@@ -569,7 +569,7 @@
if (const FunctionType *FTy =
dyn_cast<FunctionType>(PTy->getElementType()))
if (Function *OtherF =
- CurModule.CurrentModule->getNamedFunction(DID.getName()))
+ CurModule.CurrentModule->getFunction(DID.getName()))
if (FuncTysDifferOnlyBySRet(FTy,OtherF->getFunctionType())) {
V->replaceAllUsesWith(ConstantExpr::getBitCast(OtherF, PTy));
fixed = true;
@@ -1317,10 +1317,10 @@
//Not all functions use vaarg, so make a second check for ObsoleteVarArgs
{
Function* F;
- if ((F = Result->getNamedFunction("llvm.va_start"))
+ if ((F = Result->getFunction("llvm.va_start"))
&& F->getFunctionType()->getNumParams() == 0)
ObsoleteVarArgs = true;
- if((F = Result->getNamedFunction("llvm.va_copy"))
+ if((F = Result->getFunction("llvm.va_copy"))
&& F->getFunctionType()->getNumParams() == 1)
ObsoleteVarArgs = true;
}
@@ -1331,7 +1331,7 @@
}
if(ObsoleteVarArgs) {
- if(Function* F = Result->getNamedFunction("llvm.va_start")) {
+ if(Function* F = Result->getFunction("llvm.va_start")) {
if (F->arg_size() != 0) {
error("Obsolete va_start takes 0 argument");
return 0;
@@ -1360,7 +1360,7 @@
Result->getFunctionList().erase(F);
}
- if(Function* F = Result->getNamedFunction("llvm.va_end")) {
+ if(Function* F = Result->getFunction("llvm.va_end")) {
if(F->arg_size() != 1) {
error("Obsolete va_end takes 1 argument");
return 0;
@@ -1386,7 +1386,7 @@
Result->getFunctionList().erase(F);
}
- if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
+ if(Function* F = Result->getFunction("llvm.va_copy")) {
if(F->arg_size() != 1) {
error("Obsolete va_copy takes 1 argument");
return 0;
diff --git a/tools/llvm-upgrade/UpgradeParser.y.cvs b/tools/llvm-upgrade/UpgradeParser.y.cvs
index 0f47b38..3091ea3 100644
--- a/tools/llvm-upgrade/UpgradeParser.y.cvs
+++ b/tools/llvm-upgrade/UpgradeParser.y.cvs
@@ -569,7 +569,7 @@
if (const FunctionType *FTy =
dyn_cast<FunctionType>(PTy->getElementType()))
if (Function *OtherF =
- CurModule.CurrentModule->getNamedFunction(DID.getName()))
+ CurModule.CurrentModule->getFunction(DID.getName()))
if (FuncTysDifferOnlyBySRet(FTy,OtherF->getFunctionType())) {
V->replaceAllUsesWith(ConstantExpr::getBitCast(OtherF, PTy));
fixed = true;
@@ -1317,10 +1317,10 @@
//Not all functions use vaarg, so make a second check for ObsoleteVarArgs
{
Function* F;
- if ((F = Result->getNamedFunction("llvm.va_start"))
+ if ((F = Result->getFunction("llvm.va_start"))
&& F->getFunctionType()->getNumParams() == 0)
ObsoleteVarArgs = true;
- if((F = Result->getNamedFunction("llvm.va_copy"))
+ if((F = Result->getFunction("llvm.va_copy"))
&& F->getFunctionType()->getNumParams() == 1)
ObsoleteVarArgs = true;
}
@@ -1331,7 +1331,7 @@
}
if(ObsoleteVarArgs) {
- if(Function* F = Result->getNamedFunction("llvm.va_start")) {
+ if(Function* F = Result->getFunction("llvm.va_start")) {
if (F->arg_size() != 0) {
error("Obsolete va_start takes 0 argument");
return 0;
@@ -1360,7 +1360,7 @@
Result->getFunctionList().erase(F);
}
- if(Function* F = Result->getNamedFunction("llvm.va_end")) {
+ if(Function* F = Result->getFunction("llvm.va_end")) {
if(F->arg_size() != 1) {
error("Obsolete va_end takes 1 argument");
return 0;
@@ -1386,7 +1386,7 @@
Result->getFunctionList().erase(F);
}
- if(Function* F = Result->getNamedFunction("llvm.va_copy")) {
+ if(Function* F = Result->getFunction("llvm.va_copy")) {
if(F->arg_size() != 1) {
error("Obsolete va_copy takes 1 argument");
return 0;
diff --git a/tools/llvm2cpp/CppWriter.cpp b/tools/llvm2cpp/CppWriter.cpp
index e7d1185..70f5626 100644
--- a/tools/llvm2cpp/CppWriter.cpp
+++ b/tools/llvm2cpp/CppWriter.cpp
@@ -1544,7 +1544,7 @@
}
void CppWriter::printInline(const std::string& fname, const std::string& func) {
- const Function* F = TheModule->getNamedFunction(func);
+ const Function* F = TheModule->getFunction(func);
if (!F) {
error(std::string("Function '") + func + "' not found in input module");
return;
@@ -1719,7 +1719,7 @@
const std::string& fname, // Name of generated function
const std::string& funcName // Name of function to generate
) {
- const Function* F = TheModule->getNamedFunction(funcName);
+ const Function* F = TheModule->getFunction(funcName);
if (!F) {
error(std::string("Function '") + funcName + "' not found in input module");
return;