[cfe-dev] [analyzer] Evaluating a call to operator bool()
via cfe-dev
cfe-dev at lists.llvm.org
Fri Jan 10 22:05:12 PST 2020
On Wed, Jan 1, 2020 at 11:57 AM Artem Dergachev <noqnoqneo at gmail.com> wrote:
> On 12/30/19 7:55 PM, philip.chimento at gmail.com wrote:
> > However, the returned region seems to be different in the constructor
> > and in the get() method. For example I'm testing my code with a
> > "struct MyStruct : std::unique_ptr<char>" and I'll get debug output
> > such as:
> >
> > constructor: Storing 0 (Loc) into map with key
> > SymRegion{conj_$5{struct MyStruct *, LC1, S3038538, #1}}
> > get(): Retrieving key SymRegion{reg_$0<const struct MyStruct *
> > this>}: not present
> That sounds strange because i think i fixed most of these problems
> (https://www.youtube.com/watch?v=4n3l-ZcDJNY). Can you post the specific
> code you're trying to analyze? Is your Clang fresh enough?
>
I'm using 9.0.0, would this be something that I need to build the master
branch for?
The test code I'm trying to analyze is this:
struct Context;
char* StringFunc(Context* cx);
struct MyStruct : public std::unique_ptr<char> {
MyStruct(char* p) : MyStruct::unique_ptr(p) {}
operator bool() const { return !!get(); }
};
MyStruct OkayBoolConvertibleReturn(Context* cx) {
char* ptr = StringFunc(cx);
if (ptr)
return ptr;
return nullptr;
}
Cheers,
--
Philip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200110/15d5872c/attachment.html>
More information about the cfe-dev
mailing list