diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2007-04-16 06:55:42 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2007-04-16 06:55:42 +0000 |
commit | ebff55ce381a134cb4cc688641e3dd7b7bf92c47 (patch) | |
tree | 1797cc45c9d0afea2c4c371b2d64b29ce7f2ff62 | |
parent | 2db15e2b4271d09ebc33516566ba852b8567810b (diff) |
For PR1328:
Use the new parameter on Function::getIntrinsicID to identify cases where
a function is being called with an "llvm." name but it isn't actually an
intrinsic. In such cases generate an error.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36121 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AsmParser/llvmAsmParser.y | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y index 9aa81ea8dc..88cc7d30dd 100644 --- a/lib/AsmParser/llvmAsmParser.y +++ b/lib/AsmParser/llvmAsmParser.y @@ -2821,6 +2821,14 @@ InstVal : ArithmeticOps Types ValueRef ',' ValueRef { Value *V = getVal(PFTy, $4); // Get the function we're calling... CHECK_FOR_ERROR + // Check for call to invalid intrinsic to avoid crashing later. + if (Function *theF = dyn_cast<Function>(V)) { + if (theF->hasName() && 0 == strncmp(theF->getName().c_str(), "llvm.", 5)&& + !theF->getIntrinsicID(true)) + GEN_ERROR("Call to invalid LLVM intrinsic function '" + + theF->getName() + "'"); + } + // Check the arguments ValueList Args; if ($6->empty()) { // Has no arguments? |