[all-commits] [llvm/llvm-project] 4c9756: [Multilib] Custom flags YAML parsing

Victor Campos via All-commits all-commits at lists.llvm.org
Wed Nov 20 06:46:56 PST 2024


  Branch: refs/heads/users/vhscampos/multilib-flags-yaml-parsing
  Home:   https://github.com/llvm/llvm-project
  Commit: 4c9756a323f67dbe5fbdb45cf2ddb5f97adad18d
      https://github.com/llvm/llvm-project/commit/4c9756a323f67dbe5fbdb45cf2ddb5f97adad18d
  Author: Victor Campos <victor.campos at arm.com>
  Date:   2024-11-20 (Wed, 20 Nov 2024)

  Changed paths:
    M clang/include/clang/Driver/Multilib.h
    M clang/lib/Driver/Multilib.cpp
    A clang/test/Driver/baremetal-multilib-custom-flags-parsing.yaml

  Log Message:
  -----------
  [Multilib] Custom flags YAML parsing

This patch adds support for custom flags in the multilib YAML file.

Details about this change can be found in:
https://discourse.llvm.org/t/rfc-multilib-custom-flags/81058

CustomFlagDeclaration objects are instantiated using shared_ptr. This is
motivated by the fact that each custom flag value,
CustomFlagValueDetail, contains a back reference to their corresponding
flag declaration.

Since the CustomFlagDeclaration objects are transferred from the YAML
parser to the MultilibSet instance after the parsing is finished, back
references implemented as raw pointers would become dangling. This would
need to be remediated in the copy/move constructors by updating the
pointer.

Therefore it's just simpler and less error-prone to have all references
to CustomFlagDeclaration, including the back reference, as shared_ptr.
This way dangling pointers are not a concern.



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