forked from OSchip/llvm-project
[OpaquePtr][BitcodeWriter] Handle attributes with types
For example, byval. Skip the type attribute auto-upgrade if we already have the type. I've actually seen this error of the ValueEnumerator missing a type attribute's type in a non-opaque pointer context. Reviewed By: nikic Differential Revision: https://reviews.llvm.org/D105138
This commit is contained in:
parent
b810600a93
commit
cb3580e7ad
|
@ -3333,6 +3333,9 @@ Error BitcodeReader::parseFunctionRecord(ArrayRef<uint64_t> Record) {
|
|||
if (!Func->hasParamAttribute(i, Kind))
|
||||
continue;
|
||||
|
||||
if (Func->getParamAttribute(i, Kind).getValueAsType())
|
||||
continue;
|
||||
|
||||
Func->removeParamAttr(i, Kind);
|
||||
|
||||
Type *PTy = cast<FunctionType>(FTy)->getParamType(i);
|
||||
|
|
|
@ -1045,6 +1045,11 @@ void ValueEnumerator::EnumerateAttributes(AttributeList PAL) {
|
|||
if (Entry == 0) {
|
||||
AttributeGroups.push_back(Pair);
|
||||
Entry = AttributeGroups.size();
|
||||
|
||||
for (Attribute Attr : AS) {
|
||||
if (Attr.isTypeAttribute())
|
||||
EnumerateType(Attr.getValueAsType());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,3 +141,8 @@ cleanup:
|
|||
cleanup
|
||||
ret void
|
||||
}
|
||||
|
||||
; CHECK: define void @byval(ptr byval({ i32, i32 }) %0)
|
||||
define void @byval(ptr byval({ i32, i32 }) %0) {
|
||||
ret void
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue