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 | e58454d58ced15730065e14fb4ca72b0d446450d (patch) | |
| tree | c71326c36125e3458551aaccbfb383febf704c8c /lib/Analysis | |
| parent | a8b43ae4101e9f0fb978147c687586a4c4fea98f (diff) | |
| download | external_llvm-e58454d58ced15730065e14fb4ca72b0d446450d.zip external_llvm-e58454d58ced15730065e14fb4ca72b0d446450d.tar.gz external_llvm-e58454d58ced15730065e14fb4ca72b0d446450d.tar.bz2 | |
Implement checking of the tail keyword.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
| -rw-r--r-- | lib/Analysis/Lint.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Analysis/Lint.cpp b/lib/Analysis/Lint.cpp index 25d4f95..8b38733 100644 --- a/lib/Analysis/Lint.cpp +++ b/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()) { |
