summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-02-11 09:13:11 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-02-11 09:13:11 +0000
commitfad5a31160a02ac5a70c9a508cb98e6a61ce8d10 (patch)
tree7810575da2055ea927688116f8512834a922c14c /llvm/lib
parent04578fcfa5db449006766391f0f397069d14598b (diff)
downloadbcm5719-llvm-fad5a31160a02ac5a70c9a508cb98e6a61ce8d10.tar.gz
bcm5719-llvm-fad5a31160a02ac5a70c9a508cb98e6a61ce8d10.zip
AsmParser: Validate alloca's type
An alloca's type should be weird things like metadata. llvm-svn: 228820
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/AsmParser/LLParser.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index adf4c9073ab..7af85b5846c 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -4633,6 +4633,9 @@ int LLParser::ParseAlloc(Instruction *&Inst, PerFunctionState &PFS) {
if (ParseType(Ty)) return true;
+ if (!PointerType::isValidElementType(Ty))
+ return TokError("pointer to this type is invalid");
+
bool AteExtraComma = false;
if (EatIfPresent(lltok::comma)) {
if (Lex.getKind() == lltok::kw_align) {
OpenPOWER on IntegriCloud