[PATCH] D84398: [yaml2obj] - Introduce a way to set default values when using ShOffset, ShName and ShSize fields.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 23 07:58:41 PDT 2020


jhenderson added a comment.

To be clear, is the intent here is to allow yaml2obj to produce two different outputs form the same input where the only difference is that one provides a custom value and the other doesn't? How about a slightly more general concept: have a "None" special value (or "NONE" etc), parallel to llvm::Optional, which is equivalent to not specifying the field at all. This would be applicable to any optional field then, and would allow testing cases where a field may or may not exist.

For example, it could be used to allow testing Size/Content interactions:

  ...
  Sections:
    - Name: .aaa
      Size: [[SIZE=None]]
      Content: [[CONTENT=None]]
  
  # RUN: yaml2obj -o %t-with-size -DSIZE=42
  # RUN: yaml2obj -o %t-with-content -DCONTENT=aabbccddeeff
  # RUN: yaml2obj -o %t-with-both -DSIZE=42 -DCONTENT=aabbccddeeff

For ShName etc, it works the same as the proposed DEFAULT, because their values would be the default if the field wasn't specified at all.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D84398/new/

https://reviews.llvm.org/D84398





More information about the llvm-commits mailing list