[cfe-commits] [PATCH][Review Request] - fix some core dumps when analyzing C++ operator calls

Jim Goodnow II jim at thegoodnows.net
Fri Sep 17 18:14:59 PDT 2010


No problem. Since the checks that were patched have C programs as 
their tests, should I just make a new test, no-assert.cpp,  a la:

// RUN: %clang_cc1 -analyze -analyzer-check-objc-mem 
-analyzer-experimental-checks %s

class foo {
public:
         int operator*() { return 0;}
};

// following test should not assert
void fum( void )
{
         foo     f;
         *f;
}

At 04:03 PM 9/17/2010, Ted Kremenek wrote:
>Hi Jim,
>
>Can you also provide a test case so that we don't regress in the 
>future?  Thanks.
>
>
>On Sep 17, 2010, at 5:39 AM, Jim Goodnow II wrote:
>
> > Just a couple of crashes when some of the experimental checkers 
> tried to analyze C++ operator calls.
> >
> > - jim
> >
> > Index: lib/Checker/CStringChecker.cpp
> > ===================================================================
> > --- lib/Checker/CStringChecker.cpp    (revision 113834)
> > +++ lib/Checker/CStringChecker.cpp    (working copy)
> > @@ -901,6 +901,9 @@
> >   const Expr *Callee = CE->getCallee();
> >   const FunctionDecl *FD = state->getSVal(Callee).getAsFunctionDecl();
> >
> > +  // Ignore C++ operator calls or getName() will implode
> > +  if (isa<CXXOperatorCallExpr>(CE))
> > +    return false;
> >   if (!FD)
> >     return false;
> >
> > Index: lib/Checker/PthreadLockChecker.cpp
> > ===================================================================
> > --- lib/Checker/PthreadLockChecker.cpp        (revision 113834)
> > +++ lib/Checker/PthreadLockChecker.cpp        (working copy)
> > @@ -62,6 +62,9 @@
> >   const FunctionTextRegion *R =
> > 
> dyn_cast_or_null<FunctionTextRegion>(state->getSVal(Callee).getAsRegion());
> >
> > +  // Ignore C++ operator calls or getName() will implode
> > +  if (isa<CXXOperatorCallExpr>(CE))
> > +    return;
> >   if (!R)
> >     return;
> >   <opcall.patch>_______________________________________________
> > cfe-commits mailing list
> > cfe-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>
>
>No virus found in this incoming message.
>Checked by AVG - www.avg.com
>Version: 9.0.851 / Virus Database: 271.1.1/3140 - Release Date: 
>09/16/10 23:34:00




More information about the cfe-commits mailing list