mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
Add a lint check for returning the address of stack memory.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104936 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -310,6 +310,12 @@ void Lint::visitReturnInst(ReturnInst &I) {
|
||||
Assert1(!F->doesNotReturn(),
|
||||
"Unusual: Return statement in function with noreturn attribute",
|
||||
&I);
|
||||
|
||||
if (Value *V = I.getReturnValue()) {
|
||||
Value *Obj = V->getUnderlyingObject();
|
||||
Assert1(!isa<AllocaInst>(Obj) && !isa<VAArgInst>(Obj),
|
||||
"Unusual: Returning alloca or va_arg value", &I);
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Add a length argument and check that the reference is in bounds
|
||||
|
Reference in New Issue
Block a user