mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 19:12:56 +02:00
Mark CompositeType::getTypeAtIndex as const. NFC
llvm-svn: 243845
This commit is contained in:
parent
483b6f6b60
commit
0393f324d7
@ -153,8 +153,8 @@ public:
|
|||||||
/// getTypeAtIndex - Given an index value into the type, return the type of
|
/// getTypeAtIndex - Given an index value into the type, return the type of
|
||||||
/// the element.
|
/// the element.
|
||||||
///
|
///
|
||||||
Type *getTypeAtIndex(const Value *V);
|
Type *getTypeAtIndex(const Value *V) const;
|
||||||
Type *getTypeAtIndex(unsigned Idx);
|
Type *getTypeAtIndex(unsigned Idx) const;
|
||||||
bool indexValid(const Value *V) const;
|
bool indexValid(const Value *V) const;
|
||||||
bool indexValid(unsigned Idx) const;
|
bool indexValid(unsigned Idx) const;
|
||||||
|
|
||||||
|
@ -620,8 +620,8 @@ StructType *Module::getTypeByName(StringRef Name) const {
|
|||||||
// CompositeType Implementation
|
// CompositeType Implementation
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
Type *CompositeType::getTypeAtIndex(const Value *V) {
|
Type *CompositeType::getTypeAtIndex(const Value *V) const {
|
||||||
if (StructType *STy = dyn_cast<StructType>(this)) {
|
if (auto *STy = dyn_cast<StructType>(this)) {
|
||||||
unsigned Idx =
|
unsigned Idx =
|
||||||
(unsigned)cast<Constant>(V)->getUniqueInteger().getZExtValue();
|
(unsigned)cast<Constant>(V)->getUniqueInteger().getZExtValue();
|
||||||
assert(indexValid(Idx) && "Invalid structure index!");
|
assert(indexValid(Idx) && "Invalid structure index!");
|
||||||
@ -630,14 +630,16 @@ Type *CompositeType::getTypeAtIndex(const Value *V) {
|
|||||||
|
|
||||||
return cast<SequentialType>(this)->getElementType();
|
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!");
|
assert(indexValid(Idx) && "Invalid structure index!");
|
||||||
return STy->getElementType(Idx);
|
return STy->getElementType(Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
return cast<SequentialType>(this)->getElementType();
|
return cast<SequentialType>(this)->getElementType();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompositeType::indexValid(const Value *V) const {
|
bool CompositeType::indexValid(const Value *V) const {
|
||||||
if (auto *STy = dyn_cast<StructType>(this)) {
|
if (auto *STy = dyn_cast<StructType>(this)) {
|
||||||
// Structure indexes require (vectors of) 32-bit integer constants. In the
|
// Structure indexes require (vectors of) 32-bit integer constants. In the
|
||||||
|
Loading…
Reference in New Issue
Block a user