[clang] [-Wunsafe-buffer-usage] Add unique_ptr <T[]> accesses (PR #156773)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 18 13:40:50 PDT 2025


================
@@ -2606,6 +2606,19 @@ class UnsafeBufferUsageReporter : public UnsafeBufferUsageHandler {
 #endif
   }
 
+  void handleUnsafeUniquePtrArrayAccess(const DynTypedNode &Node,
+                                        bool IsRelatedToDecl,
+                                        ASTContext &Ctx) override {
+    SourceLocation Loc;
+    std::string Message;
+
+    Loc = Node.get<Stmt>()->getBeginLoc();
+    Message = "Direct operator[] access on std::unique_ptr<T[]> is unsafe "
----------------
shreya-jain wrote:

Removed the `Message` string here

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


More information about the cfe-commits mailing list