[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:
Arthur Eubanks
2021-06-29 11:38:18 -07:00
parent b810600a93
commit cb3580e7ad
3 changed files with 13 additions and 0 deletions

View File

@@ -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);