[analyzer] Nullability: Don't infer nullable when passing as nullable parameter.

You can't really infer anything from that.
This commit is contained in:
Artem Dergachev 2019-11-08 18:04:27 -08:00
parent 60ab30ebce
commit 57adc37fe5
2 changed files with 12 additions and 5 deletions

View file

@ -728,11 +728,6 @@ void NullabilityChecker::checkPreCall(const CallEvent &Call,
}
continue;
}
// No tracked nullability yet.
if (ArgExprTypeLevelNullability != Nullability::Nullable)
continue;
State = State->set<NullabilityMap>(
Region, NullabilityState(ArgExprTypeLevelNullability, ArgExpr));
}
if (State != OrigState)
C.addTransition(State);

View file

@ -0,0 +1,12 @@
// RUN: %clang_analyze_cc1 -analyzer-checker core,nullability -w -verify %s
// expected-no-diagnostics
id _Nonnull conjure_nonnull();
void use_nullable(_Nullable id x);
id _Nonnull foo() {
void *j = conjure_nonnull();
use_nullable(j);
return j; // no-warning
}