This is an archive of the discontinued LLVM Phabricator instance.

[lldb-mi] size_t rather than MIuint for arg counts.
ClosedPublic

Authored by brucem on Jul 8 2015, 10:04 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

brucem updated this revision to Diff 29298.Jul 8 2015, 10:04 PM
brucem retitled this revision from to [lldb-mi] size_t rather than MIuint for arg counts..
brucem updated this object.
brucem added reviewers: abidh, ki.stfu.
brucem added a subscriber: lldb-commits.
ki.stfu requested changes to this revision.Jul 8 2015, 11:37 PM
ki.stfu edited edge metadata.
ki.stfu added inline comments.
tools/lldb-mi/MICmdArgContext.cpp
152 ↗(On Diff #29298)

but you forgot this fact here.

tools/lldb-mi/MICmdArgContext.h
35 ↗(On Diff #29298)

nArgIndex is _const_ size_t

This revision now requires changes to proceed.Jul 8 2015, 11:37 PM
brucem updated this revision to Diff 29304.Jul 9 2015, 1:53 AM
brucem edited edge metadata.

Update per review. Removing const from header where it isn't needed.

ki.stfu accepted this revision.Jul 9 2015, 4:19 AM
ki.stfu edited edge metadata.
This revision is now accepted and ready to land.Jul 9 2015, 4:19 AM
ki.stfu requested changes to this revision.Jul 9 2015, 4:33 AM
ki.stfu edited edge metadata.
This revision now requires changes to proceed.Jul 9 2015, 4:33 AM

Looks good apart a removed const. (the same question in D11052).

brucem added a comment.Jul 9 2015, 7:12 AM

I don't think other code within LLDB really uses const scalar parameters and they don't provide much protection against anything. (They don't do anything for the caller and they only provide a minor restriction for the callee.)

Some const were removed in the MIuint to size_t patch as well, but if we decide to keep this, I can sort through and add them back.

The value of these const annotations isn't clear though.

ki.stfu added inline comments.Jul 9 2015, 9:32 PM
tools/lldb-mi/MICmdArgContext.cpp
146 ↗(On Diff #29304)

the same here: (R) means 'readonly' variable. i.e. you will not plan to return anything through that variable.

ki.stfu accepted this revision.Jul 9 2015, 9:46 PM
ki.stfu edited edge metadata.

I don't think other code within LLDB really uses const scalar parameters and they don't provide much protection against anything. (They don't do anything for the caller and they only provide a minor restriction for the callee.)

Some const were removed in the MIuint to size_t patch as well, but if we decide to keep this, I can sort through and add them back.

The value of these const annotations isn't clear though.

Ok. I agree about const for scalar and any other types in arguments: we shouldn't use const for variables that are passed by value.

Fix one inline comment and go ahead.

This revision is now accepted and ready to land.Jul 9 2015, 9:46 PM
This revision was automatically updated to reflect the committed changes.
brucem marked an inline comment as done.