This option globalize the given symbol
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
test/tools/llvm-objcopy/globalize.test | ||
---|---|---|
19–24 | You might as well get rid of this section, since you have no symbols in it. | |
tools/llvm-objcopy/llvm-objcopy.cpp | ||
327–330 | Two points regarding this and the SymbolsToLocalize bit above, which I only just noticed:
|
Applied James' suggestions :
- Refactor the std::find code into a contains function
- Removed useless section in test
- Removed useless check if (!Config.SymbolsToXX.empty())
tools/llvm-objcopy/llvm-objcopy.cpp | ||
---|---|---|
324 | empty() was not completely useless here imo - this flag is probably not the most frequently used flag, thus when it's not specified the "early check" would save us at least 3 function calls per symbol (at least in the debug builds) (std::begin/end/find) | |
tools/llvm-objcopy/llvm-objcopy.h | ||
38 ↗ | (On Diff #144301) | if it's only used in llvm-objcopy.cpp - maybe move it there ? (and make it static to avoid putting it into the global namespace) |
tools/llvm-objcopy/llvm-objcopy.h | ||
---|---|---|
39 ↗ | (On Diff #144301) | it seems to me, that the name Vector is kind of misleading here - this function (as is) is more generic - maybe replace Vector with Sequence or Container ? + change Elt to smth like X (but that's just an opinion, not super important) |
added one more inline comment, otherwise, to me this looks good, but i would wait for Jake and James
tools/llvm-objcopy/llvm-objcopy.cpp | ||
---|---|---|
138 | maybe i'm missing smth - but why not simply return bool ? |
Sure, I will wait for them to review too ! Thanks for reviewing btw :)
tools/llvm-objcopy/llvm-objcopy.cpp | ||
---|---|---|
138 | This line is here to ensure we are passing the function a container. Otherwise, it throws an error at CT. |
tools/llvm-objcopy/llvm-objcopy.cpp | ||
---|---|---|
139 | well, actually, even better - let's delete this and make use of |
tools/llvm-objcopy/llvm-objcopy.cpp | ||
---|---|---|
139 | Oups.. I'm sorry, I completely missed this function.. |
tools/llvm-objcopy/llvm-objcopy.cpp | ||
---|---|---|
324 | I think this is a case of premature optimization. A standard library implementation of .empty() might easily just use the distance between the begin and end iterator, so might end up with just as many (potentially more) calls as saved. Similarly, an optimizer might be able to optimize the calls. In other words: unless performance measurements show differently, I'd prefer to keep the code simpler. |
You might as well get rid of this section, since you have no symbols in it.