Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 941cac6

Browse files
author
Dylan McKay
committed
[emscripten] Use 'GetStructTypeOrNull' when iterating GEP operand types
1 parent a117f99 commit 941cac6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/Target/JSBackend/JSBackend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2658,7 +2658,7 @@ void JSWriter::generateExpression(const User *I, raw_string_ostream& Code) {
26582658
for (GetElementPtrInst::const_op_iterator E = GEP->op_end();
26592659
I != E; ++I) {
26602660
const Value *Index = *I;
2661-
if (StructType *STy = dyn_cast<StructType>((GTI++).getIndexedType())) {
2661+
if (StructType *STy = GTI.getStructTypeOrNull()) {
26622662
// For a struct, add the member offset.
26632663
unsigned FieldNo = cast<ConstantInt>(Index)->getZExtValue();
26642664
uint32_t Offset = DL->getStructLayout(STy)->getElementOffset(FieldNo);

0 commit comments

Comments
 (0)