[cfe-dev] how to use clang::ento::ProgramState::contains | static analyzer
Alexander Droste
alexander.ra.droste at googlemail.com
Fri Apr 10 13:39:59 PDT 2015
Meanwhile I tried calling "contains" on the other available containers
set & list after registering them with (REGISTER_SET_WITH_PROGRAMSTATE,
REGISTER_LIST_...). For those types "contains" works without any problems.
Is this a bug regarding map and the "contains" function? It seems like
it. To reproduce the compile error it is sufficient to register a map with:
REGISTER_MAP_WITH_PROGRAMSTATE(MapName, KeyType, ValueType)
and then call
// CheckerContext &context
context.getState()->contains<MapName>(KeyVal);
This should produce the compile error stated in my previous post.
On 04.04.15 15:34, Alexander Droste wrote:
> Hey everyone,
>
> while having a look at the SimpleStreamChecker example
> in the checkers folder of the static analyzer I can't figure
> out how to use the contains function.
>
> I would expect it to work like the get function so it could be called
> like this:
>
> //...
> SymbolRef FileDesc = Call.getArgSVal(0).getAsSymbol();
> ProgramStateRef State = C.getState();
> bool b = State->contains<StreamMap>(FileDesc);
>
> But trying to compile I get an error saying:
> no member named 'Contains' in'clang::ento::ProgramStateTrait<(anonymous
> namespace)::StreamMap>'...
>
> Is there another function I have to implement to get this working?
>
> --Alex
More information about the cfe-dev
mailing list