diff options
| author | David Blaikie <dblaikie@gmail.com> | 2015-04-02 18:55:32 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2015-04-02 18:55:32 +0000 |
| commit | 4a2e73b06677a199591f004f8812811ec01e2e1f (patch) | |
| tree | f6f2245fabc75040cc51b867a134d553cd36919a /llvm/lib/AsmParser | |
| parent | e3b172afc33004cb11299e21dbea1dbb4cc4dc27 (diff) | |
| download | bcm5719-llvm-4a2e73b06677a199591f004f8812811ec01e2e1f.tar.gz bcm5719-llvm-4a2e73b06677a199591f004f8812811ec01e2e1f.zip | |
[opaque pointer type] API migration for GEP constant factories
Require the pointee type to be passed explicitly and assert that it is
correct. For now it's possible to pass nullptr here (and I've done so in
a few places in this patch) but eventually that will be disallowed once
all clients have been updated or removed. It'll be a long road to get
all the way there... but if you have the cahnce to update your callers
to pass the type explicitly without depending on a pointer's element
type, that would be a good thing to do soon and a necessary thing to do
eventually.
llvm-svn: 233938
Diffstat (limited to 'llvm/lib/AsmParser')
| -rw-r--r-- | llvm/lib/AsmParser/LLParser.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index ed1d0ff9ee6..d735063d5dc 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -2831,13 +2831,10 @@ bool LLParser::ParseValID(ValID &ID, PerFunctionState *PFS) { !BasePointerType->getElementType()->isSized(&Visited)) return Error(ID.Loc, "base element of getelementptr must be sized"); - if (!GetElementPtrInst::getIndexedType( - cast<PointerType>(Elts[0]->getType()->getScalarType()) - ->getElementType(), - Indices)) + if (!GetElementPtrInst::getIndexedType(Ty, Indices)) return Error(ID.Loc, "invalid getelementptr indices"); - ID.ConstantVal = ConstantExpr::getGetElementPtr(Elts[0], Indices, - InBounds); + ID.ConstantVal = + ConstantExpr::getGetElementPtr(Ty, Elts[0], Indices, InBounds); } else if (Opc == Instruction::Select) { if (Elts.size() != 3) return Error(ID.Loc, "expected three operands to select"); |

