r178890 - [analyzer] Split new/delete checker into use-after-free and leaks parts.

Anton Yartsev anton.yartsev at gmail.com
Fri Apr 5 13:22:33 PDT 2013


On 05.04.2013 21:55, Jordan Rose wrote:
>     if (!Filter.CMallocOptimistic && !Filter.CMallocPessimistic &&
> -      !Filter.CNewDeleteChecker)
> +      !Filter.CNewDeleteLeaksChecker)
>       return;
>   
> -  if (!isTrackedFamily(C, Sym))
> +  const RefState *RS = C.getState()->get<RegionState>(Sym);
> +  assert(RS && "cannot leak an untracked symbol");
> +  AllocationFamily Family = RS->getAllocationFamily();
> +  if (!isTrackedFamily(Family))
>       return;
>   
> +  // Special case for new and new[]; these are controlled by a separate checker
> +  // flag so that they can be selectively disabled.
> +  if (Family == AF_CXXNew || Family == AF_CXXNewArray)
> +    if (!Filter.CNewDeleteLeaksChecker)
> +      return;
We already checked for Filter.CNewDeleteLeaksChecker at the beginning.

Now this works properly just because isTrackedFamily() does not know 
about CNewDeleteLeaksChecker and returns false.
What about adding bug types at this point?

-- 
Anton




More information about the cfe-commits mailing list