On Sep 5, 2012, at 15:31 , Anna Zaks <[email protected]> wrote: > Author: zaks > Date: Wed Sep 5 17:31:55 2012 > New Revision: 163261 > > URL: http://llvm.org/viewvc/llvm-project?rev=163261&view=rev > Log: > [analyzer] NullOrUndef diagnostics: track symbols binded to regions. > > If a region is binded to a symbolic value, we should track the symbol. > > (The code I changed was not previously exercised by the regression > tests.) > > Added: > cfe/trunk/test/Analysis/diagnostics/deref-track-symbolic-region.c > Modified: > cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp > > Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp?rev=163261&r1=163260&r2=163261&view=diff > ============================================================================== > --- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original) > +++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Wed Sep 5 > 17:31:55 2012 > @@ -54,7 +54,9 @@ > return U->getSubExpr()->IgnoreParenCasts(); > } > else if (const MemberExpr *ME = dyn_cast<MemberExpr>(S)) { > - return ME->getBase()->IgnoreParenCasts(); > + if (ME->isArrow()) { > + return ME->getBase()->IgnoreParenCasts(); > + } > }
This won't catch base regions that are references. Admittedly, such a thing is undefined behavior in C++, but we still warn about it. S &s = getSomeReference(); if (&s == 0) return; s.foo = 5; _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
