summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2016-12-01 23:51:30 +0000
committerJohn McCall <rjmccall@apple.com>2016-12-01 23:51:30 +0000
commit8986361fa15a4560d8a241bae726bb237b5c27e5 (patch)
tree729e24f9bffce10ef99ce3163cbfda22767447ba
parent7ffce7be0caabd4016acde2ba3a8d3ee82d52190 (diff)
downloadbcm5719-llvm-8986361fa15a4560d8a241bae726bb237b5c27e5.tar.gz
bcm5719-llvm-8986361fa15a4560d8a241bae726bb237b5c27e5.zip
Struct GEPs must use i32, not whatever size_t is. It should be safe
to do this unconditionally, given that the indices will always be small constant integers anyway. llvm-svn: 288440
-rw-r--r--clang/lib/CodeGen/ConstantBuilder.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/ConstantBuilder.h b/clang/lib/CodeGen/ConstantBuilder.h
index 6c5a5e515d1..40b34a9d61c 100644
--- a/clang/lib/CodeGen/ConstantBuilder.h
+++ b/clang/lib/CodeGen/ConstantBuilder.h
@@ -248,11 +248,13 @@ public:
// Otherwise, add an index to drill into the first level of pointer.
} else {
assert(indices.empty());
- indices.push_back(llvm::ConstantInt::get(Builder.CGM.SizeTy, 0));
+ indices.push_back(llvm::ConstantInt::get(Builder.CGM.Int32Ty, 0));
}
assert(position >= Begin);
- indices.push_back(llvm::ConstantInt::get(Builder.CGM.SizeTy,
+ // We have to use i32 here because struct GEPs demand i32 indices.
+ // It's rather unlikely to matter in practice.
+ indices.push_back(llvm::ConstantInt::get(Builder.CGM.Int32Ty,
position - Begin));
}
};
OpenPOWER on IntegriCloud