aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/iMemory.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/include/llvm/iMemory.h b/include/llvm/iMemory.h
index 1820e3c6b2..3b4a18bed0 100644
--- a/include/llvm/iMemory.h
+++ b/include/llvm/iMemory.h
@@ -173,8 +173,12 @@ public:
virtual unsigned getFirstIndexOperandNumber() const = 0;
+ inline unsigned getNumIndices() const { // Note: always non-negative
+ return (getNumOperands() - getFirstIndexOperandNumber());
+ }
+
inline bool hasIndices() const {
- return getNumOperands() > getFirstIndexOperandNumber();
+ return getNumIndices() > 0;
}
// Methods for support type inquiry through isa, cast, and dyn_cast: