[cfe-dev] Weak function pointers (was "SymbolRef and SVal confusion")

Jordan Rose jordan_rose at apple.com
Tue Jan 22 18:37:21 PST 2013


On Jan 21, 2013, at 14:22 , Richard <tarka.t.otter at googlemail.com> wrote:

> I have no great ideas about the new symbol names I'm afraid. I did notice something odd about the current implementation while writing a test though, it seems that the symbol extent range is purged after entering an IfStmt. For example, the following test code will show that the state of weakFunc is unknown in both cases:
> 
> void weakFunc() __attribute__((weak_import));
> void testWeakFunc() {
>     clang_analyzer_eval(weakFunc == NULL);   // expected UNKNOWN
>     if (weakFunc == NULL) {
>         clang_analyzer_eval(weakFunc == NULL);   // expected TRUE, actually UNKNOWN
>     }
> }
> 
> Should some code be added to SymbolReaper::isLiveRegion to handle this? At the moment this is always returning false for SymbolExtents I think.

Ah, good catch! Not SymbolExtents, but CodeTextRegions. Feel free to add that to your patch.

Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130122/3b8bdcfa/attachment.html>


More information about the cfe-dev mailing list