[cfe-commits] [Patch][Review Request]Fix for PR7287

Douglas Gregor dgregor at apple.com
Mon Nov 1 14:06:02 PDT 2010


On Nov 1, 2010, at 1:59 PM, Jim Goodnow II wrote:

> Hi,
> 
> Please review and commit this patch for PR7287. Thanks.

This isn't quite the right fix, because it won't handle, e.g., direct calls to an operator 

	operator+(x, y)


Instead, we should probably use FD->getIdentifier() and bail out early if it returns NULL.

	- Doug

> - jim
> 
> 
> Index: lib/Checker/CStringChecker.cpp
> ===================================================================
> --- lib/Checker/CStringChecker.cpp	(revision 117848)
> +++ 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 117848)
> +++ 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;
>   <PR7287.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits





More information about the cfe-commits mailing list