aboutsummaryrefslogtreecommitdiff
path: root/lib/AsmParser/LLParser.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2009-02-04 22:47:25 +0000
committerDale Johannesen <dalej@apple.com>2009-02-04 22:47:25 +0000
commit4d452de1506344bf1d28bb4a8c4ddb78c51a28c8 (patch)
tree5b7644cb0658d094afb0caa658d7fb266d6a88c6 /lib/AsmParser/LLParser.cpp
parentd0a203d76f4ef77ae1c392e8e73e2f05b676a5f2 (diff)
Reverting 63765. This broke the build of both clang
and llvm-gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/LLParser.cpp')
-rw-r--r--lib/AsmParser/LLParser.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index 60e863c53e..943f1d0025 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -2949,6 +2949,15 @@ bool LLParser::ParseCall(Instruction *&Inst, PerFunctionState &PFS,
Value *Callee;
if (ConvertValIDToValue(PFTy, CalleeID, Callee, PFS)) return true;
+ // Check for call to invalid intrinsic to avoid crashing later.
+ if (Function *F = dyn_cast<Function>(Callee)) {
+ if (F->hasName() && F->getNameLen() >= 5 &&
+ !strncmp(F->getValueName()->getKeyData(), "llvm.", 5) &&
+ !F->getIntrinsicID(true))
+ return Error(CallLoc, "Call to invalid LLVM intrinsic function '" +
+ F->getNameStr() + "'");
+ }
+
// FIXME: In LLVM 3.0, stop accepting zext, sext and inreg as optional
// function attributes.
unsigned ObsoleteFuncAttrs = Attribute::ZExt|Attribute::SExt|Attribute::InReg;