This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Helper method for checking whether two symbolic values are equal
AbandonedPublic

Authored by george.karpenkov on Jan 16 2018, 1:51 PM.

Details

Reviewers
dcoughlin
NoQ
Summary

Add a helper for checking equality to SValBuilder

Diff Detail

Event Timeline

NoQ added inline comments.Jan 17 2018, 9:53 AM
lib/StaticAnalyzer/Core/SValBuilder.cpp
417

Hmm.

"Saying that LHS is unequal to RHS is not definitely true". Which means it's either false or unknown. Which means they're either equal or not known to be unequal. Which is not what we want. We want to make sure that they cannot be unequal.

427

I don't think you need explicit casts here.

george.karpenkov marked an inline comment as done.Jan 17 2018, 2:12 PM
george.karpenkov added inline comments.
lib/StaticAnalyzer/Core/SValBuilder.cpp
417

Great point!

427

otherwise this method would just call itself recursively.

george.karpenkov marked an inline comment as done.
NoQ added inline comments.Jan 17 2018, 2:19 PM
lib/StaticAnalyzer/Core/SValBuilder.cpp
427

Whoops.

427

Maybe remove this method then?

"Saying that LHS is unequal to RHS is not definitely true". Which means it's either false or unknown. Which means they're either equal or not known to be unequal. Which is not what we want. We want to make sure that they cannot be unequal.

After thinking about this a bit more, saying that two things are equal is ambiguous in a three-valued logic (are we saying they are definitely equal or that they could be equal?)
Let's do it in a different way.

lib/StaticAnalyzer/Core/SValBuilder.cpp
427

But then I would not be able to call it from evalEQ.

george.karpenkov abandoned this revision.Jan 17 2018, 3:42 PM