diff options
Diffstat (limited to 'lib/Analysis/ReturnStackAddressChecker.cpp')
-rw-r--r-- | lib/Analysis/ReturnStackAddressChecker.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Analysis/ReturnStackAddressChecker.cpp b/lib/Analysis/ReturnStackAddressChecker.cpp index e8a014af29..e12158184c 100644 --- a/lib/Analysis/ReturnStackAddressChecker.cpp +++ b/lib/Analysis/ReturnStackAddressChecker.cpp @@ -83,6 +83,14 @@ void ReturnStackAddressChecker::PreVisitReturnStmt(CheckerContext &C, << C.getSourceManager().getInstantiationLineNumber(L) << " returned to caller"; } + else if (const BlockDataRegion *BR = dyn_cast<BlockDataRegion>(R)) { + const BlockDecl *BD = BR->getCodeRegion()->getDecl(); + SourceLocation L = BD->getLocStart(); + range = BD->getSourceRange(); + os << "Address of stack-allocated block declared on line " + << C.getSourceManager().getInstantiationLineNumber(L) + << " returned to caller"; + } else { os << "Address of stack memory associated with local variable '" << R->getString() << "' returned."; |