[all-commits] [llvm/llvm-project] 142f27: Recommit "[AST] Use APIntStorage to fix memory lea...

Craig Topper via All-commits all-commits at lists.llvm.org
Tue Jan 16 13:53:29 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 142f270c279f2576e4618fc0d1121181c7531fdf
      https://github.com/llvm/llvm-project/commit/142f270c279f2576e4618fc0d1121181c7531fdf
  Author: Craig Topper <craig.topper at sifive.com>
  Date:   2024-01-16 (Tue, 16 Jan 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    A clang/include/clang/AST/APNumericStorage.h
    M clang/include/clang/AST/Decl.h
    M clang/include/clang/AST/Expr.h
    M clang/lib/AST/Decl.cpp
    M clang/lib/CodeGen/CGBuiltin.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Serialization/ASTReaderDecl.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

  Log Message:
  -----------
  Recommit "[AST] Use APIntStorage to fix memory leak in EnumConstantDecl. (#78311)"

With lldb build fix.

Original message:

EnumConstantDecl is allocated by the ASTContext allocator so the
destructor is never called.

This patch takes a similar approach to IntegerLiteral by using
APIntStorage to allocate large APSInts using the ASTContext allocator as
well.

The downside is that an additional heap allocation and copy of the data
needs to be made when calling getInitValue if the APSInt is large.

Fixes #78160.




More information about the All-commits mailing list