This is from the review of D95518.
Per @hubert.reinterpretcast comments, we should make csect properties optional as they are not used by newly introduced debug sections in D95518.
Details
- Reviewers
hubert.reinterpretcast jasonliu jsji daltenty - Group Reviewers
Restricted Project - Commits
- rG5517923b1cac: [XCOFF][NFC] make csect properties optional for getXCOFFSection
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
llvm/include/llvm/BinaryFormat/XCOFF.h | ||
---|---|---|
409 | There's no need to use the C-style typedef + tag type pattern in C++ code. Also, the name should reflect that this type stores csect properties (and is not a selector between csect properties). | |
410 | Because we're using llvm::Optional, we can use the enumeration types. Moot point: Is attaching "V" in front a common pattern in LLVM? The way the name lookup works means that using the same name for the constructor parameter and the class member is fine. | |
411–414 | I suggest keeping the very short names for block-scope variables only. | |
llvm/include/llvm/MC/MCContext.h | ||
582–583 | Use llvm::Optional. |
llvm/lib/MC/MCContext.cpp | ||
---|---|---|
679 | This is eventually going to need to handle the case where the section is not a csect, but for this patch, I think it is okay to write it as it all XCOFF sections are csects. The patch that introduces non-csect XCOFF sections will need to do the update to this. |
@hubert.reinterpretcast Thanks for your comments. Updated accordingly.
llvm/include/llvm/BinaryFormat/XCOFF.h | ||
---|---|---|
410 | Very good idea. Before using Optional, I have to use 0xff as the default value for StorageMappingClass and SymbolType, so I need a unsigned type for the parameter. Now I can use the enumeration type because the default value for an optional parameter can be None.
Seems this is not common use. I added that for differentiating the class member name and function parameter name. But you are right, we are ok here to use the same name for them. | |
llvm/lib/MC/MCContext.cpp | ||
679 |
LGTM with minor comment.
llvm/lib/MC/MCContext.cpp | ||
---|---|---|
679 | Thanks. Let's have a TODO comment about this function's need for revision to handle non-csects in the code anyway (so this patch is better self-contained). |
There's no need to use the C-style typedef + tag type pattern in C++ code. Also, the name should reflect that this type stores csect properties (and is not a selector between csect properties).