[cfe-dev] Enhancing the DataFlowSolver in clang

Ted Kremenek kremenek at apple.com
Tue Jul 20 11:56:11 PDT 2010

On Jul 20, 2010, at 7:52 AM, Simone Pellegrini wrote:

> I run make tests from the root clang folder and none of the existing tests have been broken.
> In attachment the patch file with the fix to the DataFlowSolver.h

I think this patch is mostly there, but the following assumes that ValTy is a bitvector:

+		// if there the block value has been initialized, and this is the first
+		// iteration, use the initialized value
+		if(noEdges and !D.getBlockDataMap()[B].sizesEqual(ValTy())) 
+			Merge(V, D.getBlockDataMap()[B]);
'sizesEqual' should not appear anywhere in DataSolver.h.  The solver needs to be generic to not assume specific details of ValTy.

A performance nit: here 'getBlockDataMap()' is called twice.  That's wasteful as it requires two lookups in the hashtable instead of one.

Also, please use spaces instead of tabs.

More information about the cfe-dev mailing list