mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-02 16:56:50 +00:00
Fix crash in AttributeList::addAttributes, add test
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300614 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
51ccb32245
commit
129271c86a
@ -988,6 +988,9 @@ AttributeList AttributeList::addAttributes(LLVMContext &C, unsigned Index,
|
||||
if (!AS.hasAttributes())
|
||||
return *this;
|
||||
|
||||
if (!pImpl)
|
||||
return AttributeList::get(C, {{Index, AS}});
|
||||
|
||||
#ifndef NDEBUG
|
||||
// FIXME it is not obvious how this should work for alignment. For now, say
|
||||
// we can't change a known alignment.
|
||||
|
@ -49,4 +49,13 @@ TEST(Attributes, Ordering) {
|
||||
EXPECT_NE(SetA, SetB);
|
||||
}
|
||||
|
||||
TEST(Attributes, AddAttributes) {
|
||||
LLVMContext C;
|
||||
AttributeList AL;
|
||||
AttrBuilder B;
|
||||
B.addAttribute(Attribute::NoReturn);
|
||||
AL = AL.addAttributes(C, AttributeList::FunctionIndex, AttributeSet::get(C, B));
|
||||
EXPECT_TRUE(AL.hasFnAttribute(Attribute::NoReturn));
|
||||
}
|
||||
|
||||
} // end anonymous namespace
|
||||
|
Loading…
Reference in New Issue
Block a user