summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Analysis/ReturnStackAddressChecker.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Analysis/ReturnStackAddressChecker.cpp b/clang/lib/Analysis/ReturnStackAddressChecker.cpp
index e8a014af291..e12158184c8 100644
--- a/clang/lib/Analysis/ReturnStackAddressChecker.cpp
+++ b/clang/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.";
OpenPOWER on IntegriCloud