diff options
| author | Dan Gohman <gohman@apple.com> | 2010-05-26 21:46:36 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-05-26 21:46:36 +0000 |
| commit | 1249adf160fbb596f83749361725922aba600d03 (patch) | |
| tree | a5ea60e9baf36426dcd6b3744248cb4eaa415d5f /llvm/lib | |
| parent | 5f81b9f3f610400f09becc5d1cf005ed45c9c984 (diff) | |
| download | bcm5719-llvm-1249adf160fbb596f83749361725922aba600d03.tar.gz bcm5719-llvm-1249adf160fbb596f83749361725922aba600d03.zip | |
Implement checking of the tail keyword.
llvm-svn: 104744
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/Lint.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/Lint.cpp b/llvm/lib/Analysis/Lint.cpp index 25d4f9571da..8b3873362c8 100644 --- a/llvm/lib/Analysis/Lint.cpp +++ b/llvm/lib/Analysis/Lint.cpp @@ -219,7 +219,15 @@ void Lint::visitCallSite(CallSite CS) { // TODO: Check sret attribute. } - // TODO: Check the "tail" keyword constraints. + if (CS.isCall() && cast<CallInst>(CS.getInstruction())->isTailCall()) + for (CallSite::arg_iterator AI = CS.arg_begin(), AE = CS.arg_end(); + AI != AE; ++AI) { + Value *Obj = (*AI)->getUnderlyingObject(); + Assert1(!isa<AllocaInst>(Obj) && !isa<VAArgInst>(Obj), + "Undefined behavior: Call with \"tail\" keyword references " + "alloca or va_arg", &I); + } + if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(&I)) switch (II->getIntrinsicID()) { |

