Large mechanical patch.
s/ParamAttr/Attribute/g
s/PAList/AttrList/g
s/FnAttributeWithIndex/AttributeWithIndex/g
s/FnAttr/Attribute/g
This sets the stage
- to implement function notes as function attributes and
- to distinguish between function attributes and return value attributes.
This requires corresponding changes in llvm-gcc and clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56622 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index a1222da..1700c1e 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -131,12 +131,12 @@
bool isSigned = false,
const std::string &VariableName = "",
bool IgnoreName = false,
- const PAListPtr &PAL = PAListPtr());
+ const AttrListPtr &PAL = AttrListPtr());
std::ostream &printType(std::ostream &Out, const Type *Ty,
bool isSigned = false,
const std::string &VariableName = "",
bool IgnoreName = false,
- const PAListPtr &PAL = PAListPtr());
+ const AttrListPtr &PAL = AttrListPtr());
raw_ostream &printSimpleType(raw_ostream &Out, const Type *Ty,
bool isSigned,
const std::string &NameSoFar = "");
@@ -145,7 +145,7 @@
const std::string &NameSoFar = "");
void printStructReturnPointerFunctionType(raw_ostream &Out,
- const PAListPtr &PAL,
+ const AttrListPtr &PAL,
const PointerType *Ty);
/// writeOperandDeref - Print the result of dereferencing the specified
@@ -408,7 +408,7 @@
/// return type, except, instead of printing the type as void (*)(Struct*, ...)
/// print it as "Struct (*)(...)", for struct return functions.
void CWriter::printStructReturnPointerFunctionType(raw_ostream &Out,
- const PAListPtr &PAL,
+ const AttrListPtr &PAL,
const PointerType *TheTy) {
const FunctionType *FTy = cast<FunctionType>(TheTy->getElementType());
std::stringstream FunctionInnards;
@@ -422,12 +422,12 @@
if (PrintedType)
FunctionInnards << ", ";
const Type *ArgTy = *I;
- if (PAL.paramHasAttr(Idx, ParamAttr::ByVal)) {
+ if (PAL.paramHasAttr(Idx, Attribute::ByVal)) {
assert(isa<PointerType>(ArgTy));
ArgTy = cast<PointerType>(ArgTy)->getElementType();
}
printType(FunctionInnards, ArgTy,
- /*isSigned=*/PAL.paramHasAttr(Idx, ParamAttr::SExt), "");
+ /*isSigned=*/PAL.paramHasAttr(Idx, Attribute::SExt), "");
PrintedType = true;
}
if (FTy->isVarArg()) {
@@ -439,7 +439,7 @@
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
printType(Out, RetTy,
- /*isSigned=*/PAL.paramHasAttr(0, ParamAttr::SExt), tstr);
+ /*isSigned=*/PAL.paramHasAttr(0, Attribute::SExt), tstr);
}
raw_ostream &
@@ -537,7 +537,7 @@
//
raw_ostream &CWriter::printType(raw_ostream &Out, const Type *Ty,
bool isSigned, const std::string &NameSoFar,
- bool IgnoreName, const PAListPtr &PAL) {
+ bool IgnoreName, const AttrListPtr &PAL) {
if (Ty->isPrimitiveType() || Ty->isInteger() || isa<VectorType>(Ty)) {
printSimpleType(Out, Ty, isSigned, NameSoFar);
return Out;
@@ -558,14 +558,14 @@
for (FunctionType::param_iterator I = FTy->param_begin(),
E = FTy->param_end(); I != E; ++I) {
const Type *ArgTy = *I;
- if (PAL.paramHasAttr(Idx, ParamAttr::ByVal)) {
+ if (PAL.paramHasAttr(Idx, Attribute::ByVal)) {
assert(isa<PointerType>(ArgTy));
ArgTy = cast<PointerType>(ArgTy)->getElementType();
}
if (I != FTy->param_begin())
FunctionInnards << ", ";
printType(FunctionInnards, ArgTy,
- /*isSigned=*/PAL.paramHasAttr(Idx, ParamAttr::SExt), "");
+ /*isSigned=*/PAL.paramHasAttr(Idx, Attribute::SExt), "");
++Idx;
}
if (FTy->isVarArg()) {
@@ -577,7 +577,7 @@
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
printType(Out, FTy->getReturnType(),
- /*isSigned=*/PAL.paramHasAttr(0, ParamAttr::SExt), tstr);
+ /*isSigned=*/PAL.paramHasAttr(0, Attribute::SExt), tstr);
return Out;
}
case Type::StructTyID: {
@@ -642,7 +642,7 @@
//
std::ostream &CWriter::printType(std::ostream &Out, const Type *Ty,
bool isSigned, const std::string &NameSoFar,
- bool IgnoreName, const PAListPtr &PAL) {
+ bool IgnoreName, const AttrListPtr &PAL) {
if (Ty->isPrimitiveType() || Ty->isInteger() || isa<VectorType>(Ty)) {
printSimpleType(Out, Ty, isSigned, NameSoFar);
return Out;
@@ -663,14 +663,14 @@
for (FunctionType::param_iterator I = FTy->param_begin(),
E = FTy->param_end(); I != E; ++I) {
const Type *ArgTy = *I;
- if (PAL.paramHasAttr(Idx, ParamAttr::ByVal)) {
+ if (PAL.paramHasAttr(Idx, Attribute::ByVal)) {
assert(isa<PointerType>(ArgTy));
ArgTy = cast<PointerType>(ArgTy)->getElementType();
}
if (I != FTy->param_begin())
FunctionInnards << ", ";
printType(FunctionInnards, ArgTy,
- /*isSigned=*/PAL.paramHasAttr(Idx, ParamAttr::SExt), "");
+ /*isSigned=*/PAL.paramHasAttr(Idx, Attribute::SExt), "");
++Idx;
}
if (FTy->isVarArg()) {
@@ -682,7 +682,7 @@
FunctionInnards << ')';
std::string tstr = FunctionInnards.str();
printType(Out, FTy->getReturnType(),
- /*isSigned=*/PAL.paramHasAttr(0, ParamAttr::SExt), tstr);
+ /*isSigned=*/PAL.paramHasAttr(0, Attribute::SExt), tstr);
return Out;
}
case Type::StructTyID: {
@@ -2162,7 +2162,7 @@
// Loop over the arguments, printing them...
const FunctionType *FT = cast<FunctionType>(F->getFunctionType());
- const PAListPtr &PAL = F->getParamAttrs();
+ const AttrListPtr &PAL = F->getAttributes();
std::stringstream FunctionInnards;
@@ -2191,12 +2191,12 @@
else
ArgName = "";
const Type *ArgTy = I->getType();
- if (PAL.paramHasAttr(Idx, ParamAttr::ByVal)) {
+ if (PAL.paramHasAttr(Idx, Attribute::ByVal)) {
ArgTy = cast<PointerType>(ArgTy)->getElementType();
ByValParams.insert(I);
}
printType(FunctionInnards, ArgTy,
- /*isSigned=*/PAL.paramHasAttr(Idx, ParamAttr::SExt),
+ /*isSigned=*/PAL.paramHasAttr(Idx, Attribute::SExt),
ArgName);
PrintedArg = true;
++Idx;
@@ -2218,12 +2218,12 @@
for (; I != E; ++I) {
if (PrintedArg) FunctionInnards << ", ";
const Type *ArgTy = *I;
- if (PAL.paramHasAttr(Idx, ParamAttr::ByVal)) {
+ if (PAL.paramHasAttr(Idx, Attribute::ByVal)) {
assert(isa<PointerType>(ArgTy));
ArgTy = cast<PointerType>(ArgTy)->getElementType();
}
printType(FunctionInnards, ArgTy,
- /*isSigned=*/PAL.paramHasAttr(Idx, ParamAttr::SExt));
+ /*isSigned=*/PAL.paramHasAttr(Idx, Attribute::SExt));
PrintedArg = true;
++Idx;
}
@@ -2251,7 +2251,7 @@
// Print out the return type and the signature built above.
printType(Out, RetTy,
- /*isSigned=*/PAL.paramHasAttr(0, ParamAttr::SExt),
+ /*isSigned=*/PAL.paramHasAttr(0, Attribute::SExt),
FunctionInnards.str());
}
@@ -2844,7 +2844,7 @@
// If this is a call to a struct-return function, assign to the first
// parameter instead of passing it to the call.
- const PAListPtr &PAL = I.getParamAttrs();
+ const AttrListPtr &PAL = I.getAttributes();
bool hasByVal = I.hasByValArgument();
bool isStructRet = I.hasStructRetAttr();
if (isStructRet) {
@@ -2912,11 +2912,11 @@
(*AI)->getType() != FTy->getParamType(ArgNo)) {
Out << '(';
printType(Out, FTy->getParamType(ArgNo),
- /*isSigned=*/PAL.paramHasAttr(ArgNo+1, ParamAttr::SExt));
+ /*isSigned=*/PAL.paramHasAttr(ArgNo+1, Attribute::SExt));
Out << ')';
}
// Check if the argument is expected to be passed by value.
- if (I.paramHasAttr(ArgNo+1, ParamAttr::ByVal))
+ if (I.paramHasAttr(ArgNo+1, Attribute::ByVal))
writeOperandDeref(*AI);
else
writeOperand(*AI);