While moving objcopy into separate library(D88827), NameOrPattern::create()
was mistakenly placed into ObjcopyOptions.cpp. This patch moves
the NameOrPattern::create() into CommonConfig.h. Additionally it adds
test for using NameOrPattern.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Unit Tests
Time | Test | |
---|---|---|
60,060 ms | x64 debian > MLIR.Examples/standalone::test.toy | |
60,070 ms | x64 debian > libFuzzer.libFuzzer::large.test |
Event Timeline
llvm/include/llvm/ObjCopy/CommonConfig.h | ||
---|---|---|
113–115 | Given the complexity of this function, I think it should be in a .cpp file. | |
llvm/unittests/ObjCopy/ObjCopyTest.cpp | ||
369–372 | It seems to me like this function has a lot of copied code in it. I think you should be able to share most of it rather than just copying. | |
382 | ||
439 | If this YAML is identical to other cases, pull it into a shared constant somewhere. |
addressed comments(moved NameOrPattern::create() into .cpp, splitted functions into several smaller in ObjCopyTest.cpp)
llvm/unittests/ObjCopy/ObjCopyTest.cpp | ||
---|---|---|
439 | I suggest to not use shared constants here. These are different places(even if yaml descriptions look similar). Changing in one place should not necessarily be reflected in others. Also it is more convenient to see them inplace rather then moved to constant definition. Though if you still think we need shared constants here - will update the patch accordingly. |
llvm/lib/ObjCopy/CommonConfig.cpp | ||
---|---|---|
16 ↗ | (On Diff #413431) | I'm not sure you need the llvm:: prefix. |
llvm/unittests/ObjCopy/ObjCopyTest.cpp | ||
56 | Nit here and below: LLVM style says use loweer case for start of error messages. | |
66 | Sec is a more common abbreviation for "section". Applies elsewhere too. | |
67 | ||
79 | ||
102 | Maybe? | |
387 | Do you need the trailing return type? | |
439 | I think it should be shared: if at some point it needs to be unshared, people can make the required change then. Similarly, future developers should be careful not to make changes to shared code without understanding the implications. As a direct counterpoint to your comment: what if e.g. the YAML format changed slightly, necessitating a change to the input strings: you wouldn't want to modify the same s tring multiple timesm would you? |
llvm/unittests/ObjCopy/ObjCopyTest.cpp | ||
---|---|---|
439 |
Ok, would change to shared constants.
That would be mechanical search&replace. It looks not a problem from my point of view. |
llvm/unittests/ObjCopy/ObjCopyTest.cpp | ||
---|---|---|
439 |
Assuming the developer knew there were multiple places to change and the nature of the change is straightforward enough to be amenable to that. |
LGTM, with one suggestion.
llvm/unittests/ObjCopy/ObjCopyTest.cpp | ||
---|---|---|
26 | Simpler name: SimpleFileCOFFYAML. Similar for the others. |
Given the complexity of this function, I think it should be in a .cpp file.