mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
Fix bug: 2002-08-20-UnnamedArgument.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3401 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a8b7c04d13
commit
4cda83568e
@ -53,9 +53,8 @@ namespace {
|
||||
void printModule(Module *M);
|
||||
void printSymbolTable(const SymbolTable &ST);
|
||||
void printGlobal(const GlobalVariable *GV);
|
||||
void printFunctionSignature(const Function *F);
|
||||
void printFunctionDecl(const Function *F); // Print just the forward decl
|
||||
|
||||
void printFunctionSignature(const Function *F, bool Prototype);
|
||||
|
||||
void printFunction(Function *);
|
||||
|
||||
void printConstant(Constant *CPV);
|
||||
@ -466,8 +465,10 @@ void CWriter::printModule(Module *M) {
|
||||
// Function declarations
|
||||
if (!M->empty()) {
|
||||
Out << "\n/* Function Declarations */\n";
|
||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||
printFunctionDecl(I);
|
||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) {
|
||||
printFunctionSignature(I, true);
|
||||
Out << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Output the global variable contents...
|
||||
@ -533,14 +534,7 @@ void CWriter::printSymbolTable(const SymbolTable &ST) {
|
||||
}
|
||||
|
||||
|
||||
// printFunctionDecl - Print function declaration
|
||||
//
|
||||
void CWriter::printFunctionDecl(const Function *F) {
|
||||
printFunctionSignature(F);
|
||||
Out << ";\n";
|
||||
}
|
||||
|
||||
void CWriter::printFunctionSignature(const Function *F) {
|
||||
void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
|
||||
if (F->hasInternalLinkage()) Out << "static ";
|
||||
|
||||
// Loop over the arguments, printing them...
|
||||
@ -552,12 +546,20 @@ void CWriter::printFunctionSignature(const Function *F) {
|
||||
|
||||
if (!F->isExternal()) {
|
||||
if (!F->aempty()) {
|
||||
printType(F->afront().getType(), getValueName(F->abegin()));
|
||||
string ArgName;
|
||||
if (F->abegin()->hasName() || !Prototype)
|
||||
ArgName = getValueName(F->abegin());
|
||||
|
||||
printType(F->afront().getType(), ArgName);
|
||||
|
||||
for (Function::const_aiterator I = ++F->abegin(), E = F->aend();
|
||||
I != E; ++I) {
|
||||
Out << ", ";
|
||||
printType(I->getType(), getValueName(I));
|
||||
if (I->hasName() || !Prototype)
|
||||
ArgName = getValueName(I);
|
||||
else
|
||||
ArgName = "";
|
||||
printType(I->getType(), ArgName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -584,7 +586,7 @@ void CWriter::printFunction(Function *F) {
|
||||
|
||||
Table.incorporateFunction(F);
|
||||
|
||||
printFunctionSignature(F);
|
||||
printFunctionSignature(F, false);
|
||||
Out << " {\n";
|
||||
|
||||
// print local variable information for the function
|
||||
|
@ -53,9 +53,8 @@ namespace {
|
||||
void printModule(Module *M);
|
||||
void printSymbolTable(const SymbolTable &ST);
|
||||
void printGlobal(const GlobalVariable *GV);
|
||||
void printFunctionSignature(const Function *F);
|
||||
void printFunctionDecl(const Function *F); // Print just the forward decl
|
||||
|
||||
void printFunctionSignature(const Function *F, bool Prototype);
|
||||
|
||||
void printFunction(Function *);
|
||||
|
||||
void printConstant(Constant *CPV);
|
||||
@ -466,8 +465,10 @@ void CWriter::printModule(Module *M) {
|
||||
// Function declarations
|
||||
if (!M->empty()) {
|
||||
Out << "\n/* Function Declarations */\n";
|
||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I)
|
||||
printFunctionDecl(I);
|
||||
for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) {
|
||||
printFunctionSignature(I, true);
|
||||
Out << ";\n";
|
||||
}
|
||||
}
|
||||
|
||||
// Output the global variable contents...
|
||||
@ -533,14 +534,7 @@ void CWriter::printSymbolTable(const SymbolTable &ST) {
|
||||
}
|
||||
|
||||
|
||||
// printFunctionDecl - Print function declaration
|
||||
//
|
||||
void CWriter::printFunctionDecl(const Function *F) {
|
||||
printFunctionSignature(F);
|
||||
Out << ";\n";
|
||||
}
|
||||
|
||||
void CWriter::printFunctionSignature(const Function *F) {
|
||||
void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
|
||||
if (F->hasInternalLinkage()) Out << "static ";
|
||||
|
||||
// Loop over the arguments, printing them...
|
||||
@ -552,12 +546,20 @@ void CWriter::printFunctionSignature(const Function *F) {
|
||||
|
||||
if (!F->isExternal()) {
|
||||
if (!F->aempty()) {
|
||||
printType(F->afront().getType(), getValueName(F->abegin()));
|
||||
string ArgName;
|
||||
if (F->abegin()->hasName() || !Prototype)
|
||||
ArgName = getValueName(F->abegin());
|
||||
|
||||
printType(F->afront().getType(), ArgName);
|
||||
|
||||
for (Function::const_aiterator I = ++F->abegin(), E = F->aend();
|
||||
I != E; ++I) {
|
||||
Out << ", ";
|
||||
printType(I->getType(), getValueName(I));
|
||||
if (I->hasName() || !Prototype)
|
||||
ArgName = getValueName(I);
|
||||
else
|
||||
ArgName = "";
|
||||
printType(I->getType(), ArgName);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -584,7 +586,7 @@ void CWriter::printFunction(Function *F) {
|
||||
|
||||
Table.incorporateFunction(F);
|
||||
|
||||
printFunctionSignature(F);
|
||||
printFunctionSignature(F, false);
|
||||
Out << " {\n";
|
||||
|
||||
// print local variable information for the function
|
||||
|
Loading…
x
Reference in New Issue
Block a user