summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2015-08-01 22:52:12 +0000
committerCraig Topper <craig.topper@gmail.com>2015-08-01 22:52:12 +0000
commit0c07570c400613bf31af2667729ffb9496b3169d (patch)
tree0f9fd081686262951373b0618e1928632065af3d /llvm/lib
parent84a138a351d665332477e807b4292c1b1f7dd523 (diff)
downloadbcm5719-llvm-0c07570c400613bf31af2667729ffb9496b3169d.tar.gz
bcm5719-llvm-0c07570c400613bf31af2667729ffb9496b3169d.zip
Mark CompositeType::getTypeAtIndex as const. NFC
llvm-svn: 243845
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Type.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp
index 553fa93f585..1b46b7b01cb 100644
--- a/llvm/lib/IR/Type.cpp
+++ b/llvm/lib/IR/Type.cpp
@@ -620,8 +620,8 @@ StructType *Module::getTypeByName(StringRef Name) const {
// CompositeType Implementation
//===----------------------------------------------------------------------===//
-Type *CompositeType::getTypeAtIndex(const Value *V) {
- if (StructType *STy = dyn_cast<StructType>(this)) {
+Type *CompositeType::getTypeAtIndex(const Value *V) const {
+ if (auto *STy = dyn_cast<StructType>(this)) {
unsigned Idx =
(unsigned)cast<Constant>(V)->getUniqueInteger().getZExtValue();
assert(indexValid(Idx) && "Invalid structure index!");
@@ -630,14 +630,16 @@ Type *CompositeType::getTypeAtIndex(const Value *V) {
return cast<SequentialType>(this)->getElementType();
}
-Type *CompositeType::getTypeAtIndex(unsigned Idx) {
- if (StructType *STy = dyn_cast<StructType>(this)) {
+
+Type *CompositeType::getTypeAtIndex(unsigned Idx) const{
+ if (auto *STy = dyn_cast<StructType>(this)) {
assert(indexValid(Idx) && "Invalid structure index!");
return STy->getElementType(Idx);
}
-
+
return cast<SequentialType>(this)->getElementType();
}
+
bool CompositeType::indexValid(const Value *V) const {
if (auto *STy = dyn_cast<StructType>(this)) {
// Structure indexes require (vectors of) 32-bit integer constants. In the
OpenPOWER on IntegriCloud