Added addSection and addSymbol methods
Details
Diff Detail
Event Timeline
I think some other interesting test cases are a) adding more than one symbol/section, b) adding and then removing a symbol/section, c) removing stuff and then adding stuff, showing that the iteration still works correctly.
llvm/include/llvm/Object/MutableELFObject.h | ||
---|---|---|
171 | My instinct is that this should be a void return type. | |
346 | I think this should just be a void return type. | |
351 | I think this should just be a void return type. | |
403–408 | This seems like an unrelated change? | |
llvm/unittests/Object/MutableELFObjectTest.cpp | ||
545–547 | Comment why there's 4 sections already. | |
566–568 | Comment why there's already a symbol here. | |
570 | It's not a header. Symbols are just that - symbols (unlike sections which have a header and actual contents). So this should just be called "Sym" or something like that. |
llvm/include/llvm/Object/MutableELFObject.h | ||
---|---|---|
171 | Hmm, I'm not sure about this and the other comments. I think it is more convenient this way, but also I wonder when you would add something and then immediately change something. The cost of this return is very small though I would say. I don't have a strong opinion either way. |
llvm/include/llvm/Object/MutableELFObject.h | ||
---|---|---|
171 | My thinking is that add is akin to vector's push_back method, which doesn't return anything. | |
llvm/unittests/Object/MutableELFObjectTest.cpp | ||
545 | "yaml2obj creates the .symtab ..." | |
567 | "... creates the index 0 symbol even when ..." | |
613 | for (size_t I = 0; I < 10000; ++I) would seem more natural. I'd also reduce it to 1000 or 100 for speed. | |
624 | AddRemoveSymbol | |
659 | AddRemoveSection | |
688–705 | Could you add some new lines in this block between the groups of setup followed by checks, to make it easier to see where the interesting tests actually are, please. |
llvm/include/llvm/Object/MutableELFObject.h | ||
---|---|---|
346 | void addSymbol(MutableELFSymbol<ELFT> Sym) If you don't have a lvalue overload, taking an rvalue is usually inferior to pass-by-value because you'll not able to call addSymbol with a lvalue. | |
349 | void addSection(MutableELFSection<ELFT> Sym) I think the method is self-explanatory. No need for a comment. |
Omit Other, but why do you need the defaulted move ctor?