diff options
author | David Blaikie <dblaikie@gmail.com> | 2015-05-08 00:42:26 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2015-05-08 00:42:26 +0000 |
commit | 60310f2720b7f7b3b39ff3464479d498be17cb48 (patch) | |
tree | 4aa623d40614b8a36a7f7f7202533da2c1db2ff9 /llvm/lib/IR/Operator.cpp | |
parent | 21a3381a38d1ac001e7900b30451fe2f5fdfd55b (diff) | |
download | llvm-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.cpp | 13 |
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(); +} +} |