mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-10 18:11:26 +00:00
A couple of obvious off-by-one bugs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45852 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9de5d0dd42
commit
681d2b8266
@ -366,10 +366,11 @@ void CWriter::printStructReturnPointerFunctionType(std::ostream &Out,
|
|||||||
FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end();
|
FunctionType::param_iterator I = FTy->param_begin(), E = FTy->param_end();
|
||||||
const Type *RetTy = cast<PointerType>(I->get())->getElementType();
|
const Type *RetTy = cast<PointerType>(I->get())->getElementType();
|
||||||
unsigned Idx = 1;
|
unsigned Idx = 1;
|
||||||
for (++I; I != E; ++I) {
|
for (++I, ++Idx; I != E; ++I, ++Idx) {
|
||||||
if (PrintedType)
|
if (PrintedType)
|
||||||
FunctionInnards << ", ";
|
FunctionInnards << ", ";
|
||||||
printType(FunctionInnards, *I,
|
const Type *ArgTy = *I;
|
||||||
|
printType(FunctionInnards, ArgTy,
|
||||||
/*isSigned=*/PAL && PAL->paramHasAttr(Idx, ParamAttr::SExt), "");
|
/*isSigned=*/PAL && PAL->paramHasAttr(Idx, ParamAttr::SExt), "");
|
||||||
PrintedType = true;
|
PrintedType = true;
|
||||||
}
|
}
|
||||||
@ -1866,23 +1867,25 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
|
|||||||
if (!F->isDeclaration()) {
|
if (!F->isDeclaration()) {
|
||||||
if (!F->arg_empty()) {
|
if (!F->arg_empty()) {
|
||||||
Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
|
Function::const_arg_iterator I = F->arg_begin(), E = F->arg_end();
|
||||||
|
unsigned Idx = 1;
|
||||||
|
|
||||||
// If this is a struct-return function, don't print the hidden
|
// If this is a struct-return function, don't print the hidden
|
||||||
// struct-return argument.
|
// struct-return argument.
|
||||||
if (isStructReturn) {
|
if (isStructReturn) {
|
||||||
assert(I != E && "Invalid struct return function!");
|
assert(I != E && "Invalid struct return function!");
|
||||||
++I;
|
++I;
|
||||||
|
++Idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ArgName;
|
std::string ArgName;
|
||||||
unsigned Idx = 1;
|
|
||||||
for (; I != E; ++I) {
|
for (; I != E; ++I) {
|
||||||
if (PrintedArg) FunctionInnards << ", ";
|
if (PrintedArg) FunctionInnards << ", ";
|
||||||
if (I->hasName() || !Prototype)
|
if (I->hasName() || !Prototype)
|
||||||
ArgName = GetValueName(I);
|
ArgName = GetValueName(I);
|
||||||
else
|
else
|
||||||
ArgName = "";
|
ArgName = "";
|
||||||
printType(FunctionInnards, I->getType(),
|
const Type *ArgTy = I->getType();
|
||||||
|
printType(FunctionInnards, ArgTy,
|
||||||
/*isSigned=*/PAL && PAL->paramHasAttr(Idx, ParamAttr::SExt),
|
/*isSigned=*/PAL && PAL->paramHasAttr(Idx, ParamAttr::SExt),
|
||||||
ArgName);
|
ArgName);
|
||||||
PrintedArg = true;
|
PrintedArg = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user