[cfe-commits] r145985 - in /cfe/trunk: include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h include/clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h lib/StaticAnalyzer/Core/ProgramState.cpp lib/StaticAnalyzer/Core/RegionStore.cpp lib/StaticAnalyzer/Core/SValBuilder.cpp lib/StaticAnalyzer/Core/SVals.cpp lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp lib/StaticAnalyzer/Core/Store.cpp lib/StaticAnalyzer/Core/SymbolManager.cpp test/Analysis/taint-tester.c

Anna Zaks ganna at apple.com
Thu Dec 15 13:39:02 PST 2011


Thanks for the comments Jordy, committed in r146683!

Most examples involving floats will still not work because we do not support handling floats in the analyzer yet. (So for example, a conjured symbol will not get created when we see a float type.)

Cheers,
Anna.
On Dec 11, 2011, at 5:05 AM, Jordy Rose wrote:

> Watching all this work is very interesting. There was a PR about two casts from a float to int not showing up as the same symbolic value...wonder if this work here will fix it!
> 
> Two minor comments:
> 
> On Dec 7, 2011, at 6:12, Anna Zaks wrote:
> 
>> Modified: cfe/trunk/lib/StaticAnalyzer/Core/SValBuilder.cpp
>> 
>> DispatchCast:
>> -  // All other cases.
>> -  return isa<Loc>(val) ? evalCastFromLoc(cast<Loc>(val), castTy)
>> -                       : evalCastFromNonLoc(cast<NonLoc>(val), castTy);
>> +  // Check for casts from integers to integers.
>> +  if (castTy->isIntegerType() && originalTy->isIntegerType())
>> +    return dispatchCast(val, castTy);
>> +
>> +  return dispatchCast(val, castTy);
> 
> Are both branches of this check supposed to be the same?
> 
> 
>> Modified: cfe/trunk/lib/StaticAnalyzer/Core/Store.cpp
>> 
>> -  if (const Loc *L = dyn_cast<Loc>(&V))
>> -    return svalBuilder.evalCastFromLoc(*L, castTy);
>> -  else if (const NonLoc *NL = dyn_cast<NonLoc>(&V))
>> -    return svalBuilder.evalCastFromNonLoc(*NL, castTy);
>> -  
>> -  return V;
>> +  assert(isa<Loc>(&V) || isa<NonLoc>(&V));
>> +  return svalBuilder.dispatchCast(V, castTy);
>> 
> 
> Should this be assert(V->isDefined()), since this function no longer cares about the type of value? Even if we add some hypothetical third kind of defined SVal, dispatchCast should probably be taught to handle it.
> 
> Jordy




More information about the cfe-commits mailing list