mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-23 04:01:16 +00:00
Revert accidentally committed r217107
"Don't treat 0 as a special value for int attributes." git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217110 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fa2e31c394
commit
c7ad7ec8b9
@ -126,8 +126,7 @@ public:
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
||||
/// \brief Return a uniquified Attribute object.
|
||||
static Attribute get(LLVMContext &Context, AttrKind Kind);
|
||||
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val);
|
||||
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val = 0);
|
||||
static Attribute get(LLVMContext &Context, StringRef Kind,
|
||||
StringRef Val = StringRef());
|
||||
|
||||
|
@ -31,31 +31,12 @@ using namespace llvm;
|
||||
// Attribute Construction Methods
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
Attribute Attribute::get(LLVMContext &Context, Attribute::AttrKind Kind) {
|
||||
LLVMContextImpl *pImpl = Context.pImpl;
|
||||
FoldingSetNodeID ID;
|
||||
ID.AddInteger(Kind);
|
||||
|
||||
void *InsertPoint;
|
||||
AttributeImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint);
|
||||
|
||||
if (!PA) {
|
||||
// If we didn't find any existing attributes of the same shape then create a
|
||||
// new one and insert it.
|
||||
PA = new EnumAttributeImpl(Kind);
|
||||
pImpl->AttrsSet.InsertNode(PA, InsertPoint);
|
||||
}
|
||||
|
||||
// Return the Attribute that we found or created.
|
||||
return Attribute(PA);
|
||||
}
|
||||
|
||||
Attribute Attribute::get(LLVMContext &Context, Attribute::AttrKind Kind,
|
||||
uint64_t Val) {
|
||||
LLVMContextImpl *pImpl = Context.pImpl;
|
||||
FoldingSetNodeID ID;
|
||||
ID.AddInteger(Kind);
|
||||
ID.AddInteger(Val);
|
||||
if (Val) ID.AddInteger(Val);
|
||||
|
||||
void *InsertPoint;
|
||||
AttributeImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint);
|
||||
@ -63,7 +44,10 @@ Attribute Attribute::get(LLVMContext &Context, Attribute::AttrKind Kind,
|
||||
if (!PA) {
|
||||
// If we didn't find any existing attributes of the same shape then create a
|
||||
// new one and insert it.
|
||||
PA = new IntAttributeImpl(Kind, Val);
|
||||
if (!Val)
|
||||
PA = new EnumAttributeImpl(Kind);
|
||||
else
|
||||
PA = new IntAttributeImpl(Kind, Val);
|
||||
pImpl->AttrsSet.InsertNode(PA, InsertPoint);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user