Skip to content

Commit 774dd10

Browse files
committed
IRGen: Address a FIXME by adding an assertion to guard against invalid casts from ResilientStructTypeInfo
1 parent a312dad commit 774dd10

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/IRGen/GenStruct.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ enum class StructTypeInfoKind {
4949
FixedStructTypeInfo,
5050
ClangRecordTypeInfo,
5151
NonFixedStructTypeInfo,
52+
ResilientStructTypeInfo
5253
};
5354

5455
static StructTypeInfoKind getStructTypeInfoKind(const TypeInfo &type) {
55-
// FIXME: check that this is not a resilient struct type
5656
return (StructTypeInfoKind) type.getSubclassKind();
5757
}
5858

@@ -718,6 +718,8 @@ class ClangRecordLowering {
718718
return structTI.as<FixedStructTypeInfo>().op(IGF, __VA_ARGS__); \
719719
case StructTypeInfoKind::NonFixedStructTypeInfo: \
720720
return structTI.as<NonFixedStructTypeInfo>().op(IGF, __VA_ARGS__); \
721+
case StructTypeInfoKind::ResilientStructTypeInfo: \
722+
llvm_unreachable("resilient structs are opaque"); \
721723
} \
722724
llvm_unreachable("bad struct type info kind!"); \
723725
} while(0)
@@ -758,7 +760,9 @@ namespace {
758760
{
759761
public:
760762
ResilientStructTypeInfo(llvm::Type *T)
761-
: ResilientTypeInfo(T) { }
763+
: ResilientTypeInfo(T) {
764+
setSubclassKind((unsigned) StructTypeInfoKind::ResilientStructTypeInfo);
765+
}
762766
};
763767
}
764768

0 commit comments

Comments
 (0)