aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Operator.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2015-05-08 00:42:26 +0000
committerDavid Blaikie <dblaikie@gmail.com>2015-05-08 00:42:26 +0000
commit60310f2720b7f7b3b39ff3464479d498be17cb48 (patch)
tree4aa623d40614b8a36a7f7f7202533da2c1db2ff9 /llvm/lib/IR/Operator.cpp
parent21a3381a38d1ac001e7900b30451fe2f5fdfd55b (diff)
downloadllvm-60310f2720b7f7b3b39ff3464479d498be17cb48.zip
llvm-60310f2720b7f7b3b39ff3464479d498be17cb48.tar.gz
llvm-60310f2720b7f7b3b39ff3464479d498be17cb48.tar.bz2
[opaque pointer type] Explicit pointee type for GEPOperator/GEPConstantExpr.
Also a couple of other changes to avoid use of PointerType::getElementType here & there too. llvm-svn: 236799
Diffstat (limited to 'llvm/lib/IR/Operator.cpp')
-rw-r--r--llvm/lib/IR/Operator.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/IR/Operator.cpp b/llvm/lib/IR/Operator.cpp
new file mode 100644
index 0000000..dd62b04
--- /dev/null
+++ b/llvm/lib/IR/Operator.cpp
@@ -0,0 +1,13 @@
+#include "llvm/IR/Operator.h"
+#include "llvm/IR/Instructions.h"
+#include "llvm/IR/Type.h"
+
+#include "ConstantsContext.h"
+
+namespace llvm {
+Type *GEPOperator::getSourceElementType() const {
+ if (auto *I = dyn_cast<GetElementPtrInst>(this))
+ return I->getSourceElementType();
+ return cast<GetElementPtrConstantExpr>(this)->getSourceElementType();
+}
+}