[all-commits] [llvm/llvm-project] 3e20ba: Reapply "[clang] Introduce [[clang::lifetime_captu...

Utkarsh Saxena via All-commits all-commits at lists.llvm.org
Wed Nov 13 02:07:42 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3e20bae827c0a314142fea74aa3d7ead039fab3d
      https://github.com/llvm/llvm-project/commit/3e20bae827c0a314142fea74aa3d7ead039fab3d
  Author: Utkarsh Saxena <usx at google.com>
  Date:   2024-11-13 (Wed, 13 Nov 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/Attr.td
    M clang/include/clang/Basic/AttrDocs.td
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/include/clang/Sema/Sema.h
    M clang/lib/AST/TypePrinter.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaDeclAttr.cpp
    M clang/lib/Sema/SemaType.cpp
    A clang/test/AST/attr-lifetime-capture-by.cpp
    A clang/test/SemaCXX/attr-lifetime-capture-by.cpp

  Log Message:
  -----------
  Reapply "[clang] Introduce [[clang::lifetime_capture_by(X)]] (#115823)

Fix compile time regression and memory leak

In the previous change, we saw:
- Memory leak: https://lab.llvm.org/buildbot/#/builders/169/builds/5193
- 0.5% Compile time regression
[link](https://llvm-compile-time-tracker.com/compare.php?from=4a68e4cbd2423dcacada8162ab7c4bb8d7f7e2cf&to=8c4331c1abeb33eabf3cdbefa7f2b6e0540e7f4f&stat=instructions:u)

For compile time regression, we make the Param->Idx `StringMap` for
**all** functions. This `StringMap` is expensive and should not be
computed when none of the params are annotated with
`[[clang::lifetime_capture_by(X)]]`.

For the memory leak, the small vectors used in Attribute are not
destroyed because the attributes are allocated through ASTContext's
allocator. We therefore need a raw array in this case.



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