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 | ||
---|---|---|
173 | My instinct is that this should be a void return type. | |
352 | I think this should just be a void return type. | |
357 | I think this should just be a void return type. | |
414–419 | This seems like an unrelated change? | |
llvm/unittests/Object/MutableELFObjectTest.cpp | ||
523–525 | Comment why there's 4 sections already. | |
544–546 | Comment why there's already a symbol here. | |
548 | 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 | ||
---|---|---|
173 | 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 | ||
---|---|---|
173 | My thinking is that add is akin to vector's push_back method, which doesn't return anything. | |
llvm/unittests/Object/MutableELFObjectTest.cpp | ||
523 | "yaml2obj creates the .symtab ..." | |
545 | "... creates the index 0 symbol even when ..." | |
591 | for (size_t I = 0; I < 10000; ++I) would seem more natural. I'd also reduce it to 1000 or 100 for speed. | |
602 | AddRemoveSymbol | |
637 | AddRemoveSection | |
666–683 | 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 | ||
---|---|---|
352 | 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. | |
355 | 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?