diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-06-14 17:46:38 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2019-06-14 17:46:38 +0000 |
commit | 27252a1f9546ba379b76176d6f6707a1ae8d05cd (patch) | |
tree | 154bfc319ec7f544da295c4863cb9cb16807c7e1 /clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | |
parent | 24cdcadcc5e875b05bbb70eb123ea4f0a018ee83 (diff) | |
download | bcm5719-llvm-27252a1f9546ba379b76176d6f6707a1ae8d05cd.tar.gz bcm5719-llvm-27252a1f9546ba379b76176d6f6707a1ae8d05cd.zip |
PR23833, DR2140: an lvalue-to-rvalue conversion on a glvalue of type
nullptr_t does not access memory.
We now reuse CK_NullToPointer to represent a conversion from a glvalue
of type nullptr_t to a prvalue of nullptr_t where necessary.
This reinstates r363337, reverted in r363352.
llvm-svn: 363429
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp index df78b49130c..cc62cf1048c 100644 --- a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp +++ b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp @@ -378,7 +378,6 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex, case CK_BitCast: case CK_AddressSpaceConversion: case CK_BooleanToSignedIntegral: - case CK_NullToPointer: case CK_IntegralToPointer: case CK_PointerToIntegral: { SVal V = state->getSVal(Ex, LCtx); @@ -503,6 +502,12 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex, Bldr.generateNode(CastE, Pred, state); continue; } + case CK_NullToPointer: { + SVal V = svalBuilder.makeNull(); + state = state->BindExpr(CastE, LCtx, V); + Bldr.generateNode(CastE, Pred, state); + continue; + } case CK_NullToMemberPointer: { SVal V = svalBuilder.getMemberPointer(nullptr); state = state->BindExpr(CastE, LCtx, V); |