mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-18 14:31:27 +00:00
Remember to move a type to the correct set when setting the body.
We would set the body of a struct type (therefore making it non-opaque) but were forgetting to move it to the non-opaque set. Fixes pr22807. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231442 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b207e98e20
commit
b6fd95ab41
@ -54,6 +54,7 @@ public:
|
||||
NonOpaqueStructTypeSet NonOpaqueStructTypes;
|
||||
|
||||
void addNonOpaque(StructType *Ty);
|
||||
void switchToNonOpaque(StructType *Ty);
|
||||
void addOpaque(StructType *Ty);
|
||||
StructType *findNonOpaque(ArrayRef<Type *> ETypes, bool IsPacked);
|
||||
bool hasType(StructType *Ty);
|
||||
|
@ -226,6 +226,7 @@ void TypeMapTy::linkDefinedTypeBodies() {
|
||||
Elements[I] = get(SrcSTy->getElementType(I));
|
||||
|
||||
DstSTy->setBody(Elements, SrcSTy->isPacked());
|
||||
DstStructTypesSet.switchToNonOpaque(DstSTy);
|
||||
}
|
||||
SrcDefinitionsToResolve.clear();
|
||||
DstResolvedOpaqueTypes.clear();
|
||||
@ -1678,6 +1679,14 @@ void Linker::IdentifiedStructTypeSet::addNonOpaque(StructType *Ty) {
|
||||
NonOpaqueStructTypes.insert(Ty);
|
||||
}
|
||||
|
||||
void Linker::IdentifiedStructTypeSet::switchToNonOpaque(StructType *Ty) {
|
||||
assert(!Ty->isOpaque());
|
||||
NonOpaqueStructTypes.insert(Ty);
|
||||
bool Removed = OpaqueStructTypes.erase(Ty);
|
||||
(void)Removed;
|
||||
assert(Removed);
|
||||
}
|
||||
|
||||
void Linker::IdentifiedStructTypeSet::addOpaque(StructType *Ty) {
|
||||
assert(Ty->isOpaque());
|
||||
OpaqueStructTypes.insert(Ty);
|
||||
|
6
test/Linker/Inputs/pr22807-1.ll
Normal file
6
test/Linker/Inputs/pr22807-1.ll
Normal file
@ -0,0 +1,6 @@
|
||||
%struct.A = type { %struct.B* }
|
||||
%struct.B = type opaque
|
||||
|
||||
define i32 @foo(%struct.A** %A) {
|
||||
ret i32 0
|
||||
}
|
6
test/Linker/Inputs/pr22807-2.ll
Normal file
6
test/Linker/Inputs/pr22807-2.ll
Normal file
@ -0,0 +1,6 @@
|
||||
%struct.A = type { %struct.B* }
|
||||
%struct.B = type opaque
|
||||
|
||||
define i32 @bar(%struct.A* %A) {
|
||||
ret i32 0
|
||||
}
|
13
test/Linker/pr22807.ll
Normal file
13
test/Linker/pr22807.ll
Normal file
@ -0,0 +1,13 @@
|
||||
; RUN: llvm-link -S -o - %p/pr22807.ll %p/Inputs/pr22807-1.ll %p/Inputs/pr22807-2.ll | FileCheck %s
|
||||
|
||||
; CHECK-NOT: type
|
||||
; CHECK: %struct.B = type { %struct.A* }
|
||||
; CHECK-NEXT: %struct.A = type { %struct.B* }
|
||||
; CHECK-NOT: type
|
||||
|
||||
%struct.B = type { %struct.A* }
|
||||
%struct.A = type opaque
|
||||
|
||||
define i32 @baz(%struct.B* %BB) {
|
||||
ret i32 0
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user