[cfe-dev] [analyzer] Dynamic type information for non-class pointers (void*, nonloc::LocAsInteger ...)

Kristóf Umann via cfe-dev cfe-dev at lists.llvm.org
Thu Jun 21 10:47:40 PDT 2018


Hello! :)

In short: Is it possible to obtain the type of the region a void* or
nonloc::LocAsInteger object points to? Note that this is a C++-only checker.

In detail:

I'm working on numerous fixes to UninitializedObjectChecker. I am however
stuck at two of them:

* instead of ignoring void pointer types, I intend to obtain the object it
points to by first acquiring the dynamic type of the pointer
* handle nonloc::LocAsInteger, where I'll also need obtain a dynamic type.

However, after carefully reading Artem Degrachev's (absolutely
outstanding!) guide "Clang Static Analyzer -- A Checker Developer's Guide",
in section 4.3.6 (about check::Bind) I found this statement:
"Not every memory region has a type; for example, any void pointer points
to a certain memory region, but the analyzer cannot afford making
assumptions about the type of values stored in such region.".

I have looked around in the code, have found `getDynamicTypeInfo`, and
tried various other methods, but I start to think that this hasn't changed
since the time that statement was written. Is this correct?

Best regards,
Kristóf Umann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180621/dec0dad8/attachment.html>


More information about the cfe-dev mailing list