[llvm-commits] CVS: llvm/lib/AsmParser/llvmAsmParser.y
Reid Spencer
reid at x10sys.com
Sun Apr 15 23:56:03 PDT 2007
Changes in directory llvm/lib/AsmParser:
llvmAsmParser.y updated: 1.339 -> 1.340
---
Log message:
For PR1328: http://llvm.org/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.
---
Diffs of the changes: (+8 -0)
llvmAsmParser.y | 8 ++++++++
1 files changed, 8 insertions(+)
Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.339 llvm/lib/AsmParser/llvmAsmParser.y:1.340
--- llvm/lib/AsmParser/llvmAsmParser.y:1.339 Thu Apr 12 13:32:50 2007
+++ llvm/lib/AsmParser/llvmAsmParser.y Mon Apr 16 01:55:42 2007
@@ -2821,6 +2821,14 @@
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?
More information about the llvm-commits
mailing list