[all-commits] [llvm/llvm-project] 2228b4: clang: Handle deleting pointers to incomplete arra...

Harald van Dijk via All-commits all-commits at lists.llvm.org
Thu Jul 24 10:43:39 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 2228b4b46c3e45b5aab801a636041ed13ae47375
      https://github.com/llvm/llvm-project/commit/2228b4b46c3e45b5aab801a636041ed13ae47375
  Author: Harald van Dijk <harald.vandijk at codeplay.com>
  Date:   2025-07-24 (Thu, 24 Jul 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/CodeGen/CGExprCXX.cpp
    M clang/test/CodeGenCXX/delete.cpp

  Log Message:
  -----------
  clang: Handle deleting pointers to incomplete array types (#150359)

CodeGenFunction::EmitCXXDeleteExpr contains logic to go from a pointer
to an array to a pointer to the first element of the array using a
getelementptr LLVM IR instruction. This was done for pointers that were
not variable length arrays, as pointers to variable length arrays never
existed in LLVM IR, but rather than checking for arrays that were not
variable length arrays, it checked for arrays that had a constant bound.
This caused incomplete arrays to be inadvertently omitted.

This getelementptr was necessary back when LLVM IR used typed pointers,
but they have been gone for a while, a gep with a constant zero offset
does nothing now, so we can simplify the code by removing that.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list