forked from OSchip/llvm-project
[NFC] Cleanup AttributeList::getStackAlignment()
So that we don't use a confusing index.
This commit is contained in:
parent
cd28003336
commit
7c8206cd2a
|
@ -821,8 +821,11 @@ public:
|
|||
/// Return the elementtype type for the specified function parameter.
|
||||
Type *getParamElementType(unsigned ArgNo) const;
|
||||
|
||||
/// Get the stack alignment.
|
||||
MaybeAlign getStackAlignment(unsigned Index) const;
|
||||
/// Get the stack alignment of the function.
|
||||
MaybeAlign getFnStackAlignment() const;
|
||||
|
||||
/// Get the stack alignment of the return value.
|
||||
MaybeAlign getRetStackAlignment() const;
|
||||
|
||||
/// Get the number of dereferenceable bytes (or zero if unknown) of the return
|
||||
/// value.
|
||||
|
|
|
@ -425,7 +425,7 @@ public:
|
|||
|
||||
/// Return the stack alignment for the function.
|
||||
MaybeAlign getFnStackAlign() const {
|
||||
return AttributeSets.getStackAlignment(AttributeList::FunctionIndex);
|
||||
return AttributeSets.getFnStackAlignment();
|
||||
}
|
||||
|
||||
/// Returns true if the function has ssp, sspstrong, or sspreq fn attrs.
|
||||
|
|
|
@ -1462,8 +1462,12 @@ Type *AttributeList::getParamElementType(unsigned Index) const {
|
|||
return getAttributes(Index + FirstArgIndex).getElementType();
|
||||
}
|
||||
|
||||
MaybeAlign AttributeList::getStackAlignment(unsigned Index) const {
|
||||
return getAttributes(Index).getStackAlignment();
|
||||
MaybeAlign AttributeList::getFnStackAlignment() const {
|
||||
return getFnAttrs().getStackAlignment();
|
||||
}
|
||||
|
||||
MaybeAlign AttributeList::getRetStackAlignment() const {
|
||||
return getRetAttrs().getStackAlignment();
|
||||
}
|
||||
|
||||
uint64_t AttributeList::getRetDereferenceableBytes() const {
|
||||
|
|
|
@ -106,7 +106,7 @@ TEST(Attributes, RemoveAlign) {
|
|||
EXPECT_TRUE(AL.hasRetAttrs());
|
||||
EXPECT_TRUE(AL.hasRetAttr(Attribute::StackAlignment));
|
||||
EXPECT_TRUE(AL.hasRetAttr(Attribute::OptimizeNone));
|
||||
EXPECT_TRUE(AL.getStackAlignment(0) == 32);
|
||||
EXPECT_TRUE(AL.getRetStackAlignment() == 32);
|
||||
EXPECT_TRUE(AL.hasParamAttrs(0));
|
||||
EXPECT_TRUE(AL.hasParamAttr(0, Attribute::Alignment));
|
||||
EXPECT_TRUE(AL.hasParamAttr(0, Attribute::ReadOnly));
|
||||
|
@ -117,7 +117,7 @@ TEST(Attributes, RemoveAlign) {
|
|||
EXPECT_TRUE(AL.hasParamAttr(0, Attribute::ReadOnly));
|
||||
EXPECT_TRUE(AL.hasRetAttr(Attribute::StackAlignment));
|
||||
EXPECT_TRUE(AL.hasRetAttr(Attribute::OptimizeNone));
|
||||
EXPECT_TRUE(AL.getStackAlignment(0) == 32);
|
||||
EXPECT_TRUE(AL.getRetStackAlignment() == 32);
|
||||
|
||||
AL = AL.removeRetAttribute(C, Attribute::StackAlignment);
|
||||
EXPECT_FALSE(AL.hasParamAttr(0, Attribute::Alignment));
|
||||
|
@ -134,7 +134,7 @@ TEST(Attributes, RemoveAlign) {
|
|||
EXPECT_TRUE(AL2.hasParamAttr(0, Attribute::ReadOnly));
|
||||
EXPECT_TRUE(AL2.hasRetAttr(Attribute::StackAlignment));
|
||||
EXPECT_TRUE(AL2.hasRetAttr(Attribute::OptimizeNone));
|
||||
EXPECT_TRUE(AL2.getStackAlignment(0) == 32);
|
||||
EXPECT_TRUE(AL2.getRetStackAlignment() == 32);
|
||||
|
||||
AL2 = AL2.removeRetAttributes(C, B_stackalign);
|
||||
EXPECT_FALSE(AL2.hasParamAttr(0, Attribute::Alignment));
|
||||
|
|
Loading…
Reference in New Issue