[clang] [Clang] Prevent null dereferences (PR #115502)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 8 08:32:00 PST 2024


================
@@ -2265,7 +2265,7 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler {
       } else if (isa<MemberExpr>(Operation)) {
         // note_unsafe_buffer_operation doesn't have this mode yet.
         assert(!IsRelatedToDecl && "Not implemented yet!");
-        auto ME = dyn_cast<MemberExpr>(Operation);
+        auto ME = cast<MemberExpr>(Operation);
----------------
Fznamznon wrote:

NIT: afaik, coding guidelines suggest adding `*` 
```suggestion
        auto *ME = cast<MemberExpr>(Operation);
```

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


More information about the cfe-commits mailing list