[cfe-dev] Allowing checkers to mark symbols as live

Jordy Rose jediknil at belkadan.com
Wed Aug 11 18:33:24 PDT 2010


On Thu, 12 Aug 2010 09:04:02 +0800, Zhongxing Xu <xuzhongxing at gmail.com>
wrote:
> On Thu, Aug 12, 2010 at 8:11 AM, Ted Kremenek <kremenek at apple.com>
wrote:
>> I think this can be simplified a bit.  How about changing:
>>
>>  for (CStringLength::EntryMap::iterator I = Entries.begin(), E =
>> Entries.end();
>>       I != E; ++I) {
>>    SVal Len = I.getData();
>>    if (const SymbolMetadata *Sym =
>> dyn_cast<SymbolMetadata>(Len.getAsSymbol()))
>>      SR.markInUse(Sym);
>>  }
>>
>> to:
>>
>>  for (CStringLength::EntryMap::iterator I = Entries.begin(), E =
>> Entries.end();
>>       I != E; ++I) {
>>    if (const SymbolRef *Sym = Len.getAsSymbol())
>>      SR.markInUse(Sym);
>>
>> and then let SymbolManager decide if it needs to do anything special
for
>> the SymbolRef passed to 'markInUse'.  That seems cleaner from an API
>> perspective, as it leaves SymbolReaper in the business of deciding when
a
>> symbol is live (and how it decides when it is live).  In other words,
>> just move the dyn_cast<SymbolMetadata> to markInUse.
> 
> Would this over generalize this API or generalize this API too early?

Yeah, I was trying to show that checkers should only be using metadata
symbols (and not, say, conjured symbols). But given that markLive() is
around anyway, maybe it's not worth it. Ted's code certainly makes things
easier for checker clients.



More information about the cfe-dev mailing list