[analyzer] Pointers-to-members are (currently) Locs, not NonLocs.
While we don't model pointers-to-members besides "null" and "non-null", we were using Loc symbols for valid pointers and NonLoc integers for the null case. This hit the assert committed in r185401. Fixed by using a true (Loc) null for null member pointers. llvm-svn: 185444
This commit is contained in:
parent
68a62d67f3
commit
00deddb6d8
|
@ -371,7 +371,7 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex,
|
|||
}
|
||||
case CK_NullToMemberPointer: {
|
||||
// FIXME: For now, member pointers are represented by void *.
|
||||
SVal V = svalBuilder.makeIntValWithPtrWidth(0, true);
|
||||
SVal V = svalBuilder.makeNull();
|
||||
state = state->BindExpr(CastE, LCtx, V);
|
||||
Bldr.generateNode(CastE, Pred, state);
|
||||
continue;
|
||||
|
|
|
@ -33,6 +33,7 @@ void testConditionalUse() {
|
|||
|
||||
void testComparison() {
|
||||
clang_analyzer_eval(&A::getPtr == &A::getPtr); // expected-warning{{TRUE}}
|
||||
clang_analyzer_eval(&A::getPtr == 0); // expected-warning{{FALSE}}
|
||||
|
||||
// FIXME: Should be TRUE.
|
||||
clang_analyzer_eval(&A::m_ptr == &A::m_ptr); // expected-warning{{UNKNOWN}}
|
||||
|
|
Loading…
Reference in New Issue