mirror of
https://github.com/intel/llvm.git
synced 2026-02-08 17:28:30 +08:00
Enhance return-of-stack-address checker to recognize regions created by alloca().
llvm-svn: 58553
This commit is contained in:
@@ -216,6 +216,15 @@ public:
|
||||
|
||||
R = CL->getSourceRange();
|
||||
}
|
||||
else if (const AllocaRegion* AR = dyn_cast<AllocaRegion>(V.getRegion())) {
|
||||
const Expr* ARE = AR->getExpr();
|
||||
SourceLocation L = ARE->getLocStart();
|
||||
R = ARE->getSourceRange();
|
||||
|
||||
os << "Address of stack memory allocated by call to alloca() on line "
|
||||
<< BR.getSourceManager().getLogicalLineNumber(L)
|
||||
<< " returned.";
|
||||
}
|
||||
else {
|
||||
os << "Address of stack memory associated with local variable '"
|
||||
<< V.getRegion()->getString() << "' returned.";
|
||||
|
||||
Reference in New Issue
Block a user