[clang] [clang][ExprConst] Reject field access with nullptr base (PR #113885)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 29 07:32:22 PDT 2024


================
@@ -1703,7 +1703,7 @@ namespace {
     bool checkNullPointerDiagnosingWith(const GenDiagType &GenDiag) {
       if (Designator.Invalid)
         return false;
-      if (IsNullPtr) {
+      if (getLValueBase().isNull()) {
----------------
tbaederr wrote:

The offset is added in `adjustOffset()`, which calls `clearIsNullPointer()`. This is called _before_ we call `addDecl()`, so at that point the pointer is already considered non-null.

https://github.com/llvm/llvm-project/pull/113885


More information about the cfe-commits mailing list