Removed some unused variables, added some consts, changed some casts
to const_cast. I don't think any of these changes are very
controversial.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
I think it's a good idea to use static_cast/static_pointer_cast/reinterpret_cast over C-style casts.
It probably does not make sense to go in and change everything again, but I would also prefer C++ casts next time - it makes things more explicit and easier to review. LGTM.
Looks good overall. I don't like removing "const". Why does GCC warn on the first arg "const unsigned char* ptr"?
static inline void WriteSwappedInt64(const unsigned char* ptr, unsigned offset, uint64_t value)
include/lldb/Core/DataEncoder.h | ||
---|---|---|
359–360 ↗ | (On Diff #25494) | Why do we need to remove const here? |
source/Core/DataEncoder.cpp | ||
24–53 ↗ | (On Diff #25494) | Why do we need to remove const here? |
156 ↗ | (On Diff #25494) | Why do we need to remove const here? |
include/lldb/Core/DataEncoder.h | ||
---|---|---|
359–360 ↗ | (On Diff #25494) | That buffer is the one that data encoder writes to. Internally, it is stored as a non-const pointer to enable these writes. I think it's wrong to provide a const guarantee in the interface when we know we're going to modify it. |
source/Core/DataEncoder.cpp | ||
24–53 ↗ | (On Diff #25494) | ptr is going to be modified so we shouldn't be providing a const guarantee. |
156 ↗ | (On Diff #25494) | See first comment |
"ptr" isn't being modified in any of the WriteInt* functions...
source/Core/DataEncoder.cpp | ||
---|---|---|
53 ↗ | (On Diff #25494) | How is "ptr" modified here? It is just casted and used in pointer math, but it isn't being modified... |
Never mind.. It is writing to the memory... I was thinking read, not with. Ignore me.