Skip to content

Commit fb4bbba

Browse files
r-barnesfacebook-github-bot
authored andcommitted
Fix shadowed variable in gloo/reduce.h
Summary: Our upcoming compiler upgrade will require us not to have shadowed variables. Such variables have a _high_ bug rate and reduce readability, so we would like to avoid them even if the compiler was not forcing us to do so. This codemod attempts to fix an instance of a shadowed variable. Please review with care: if it's failed the result will be a silent bug. **What's a shadowed variable?** Shadowed variables are variables in an inner scope with the same name as another variable in an outer scope. Having the same name for both variables might be semantically correct, but it can make the code confusing to read! It can also hide subtle bugs. This diff fixes such an issue by renaming the variable. - If you approve of this diff, please use the "Accept & Ship" button :-) Reviewed By: meyering Differential Revision: D52582899 fbshipit-source-id: cfcf9eff9b3820ab4d2e3f4fac3efc72c0882d3d
1 parent 457bc94 commit fb4bbba

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

gloo/reduce.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ class ReduceOptions {
3131
}
3232

3333
template <typename T>
34-
void setInput(T* ptr, size_t elements) {
35-
this->elements = elements;
34+
void setInput(T* ptr, size_t elements_2) {
35+
this->elements = elements_2;
3636
this->elementSize = sizeof(T);
37-
this->in = context->createUnboundBuffer(ptr, elements * sizeof(T));
37+
this->in = context->createUnboundBuffer(ptr, elements_2 * sizeof(T));
3838
}
3939

4040
template <typename T>
@@ -45,30 +45,30 @@ class ReduceOptions {
4545
}
4646

4747
template <typename T>
48-
void setOutput(T* ptr, size_t elements) {
49-
this->elements = elements;
48+
void setOutput(T* ptr, size_t elements_2) {
49+
this->elements = elements_2;
5050
this->elementSize = sizeof(T);
51-
this->out = context->createUnboundBuffer(ptr, elements * sizeof(T));
51+
this->out = context->createUnboundBuffer(ptr, elements_2 * sizeof(T));
5252
}
5353

54-
void setRoot(int root) {
55-
this->root = root;
54+
void setRoot(int root_2) {
55+
this->root = root_2;
5656
}
5757

5858
void setReduceFunction(Func fn) {
5959
this->reduce = fn;
6060
}
6161

62-
void setTag(uint32_t tag) {
63-
this->tag = tag;
62+
void setTag(uint32_t tag_2) {
63+
this->tag = tag_2;
6464
}
6565

66-
void setMaxSegmentSize(size_t maxSegmentSize) {
67-
this->maxSegmentSize = maxSegmentSize;
66+
void setMaxSegmentSize(size_t maxSegmentSize_2) {
67+
this->maxSegmentSize = maxSegmentSize_2;
6868
}
6969

70-
void setTimeout(std::chrono::milliseconds timeout) {
71-
this->timeout = timeout;
70+
void setTimeout(std::chrono::milliseconds timeout_2) {
71+
this->timeout = timeout_2;
7272
}
7373

7474
protected:

0 commit comments

Comments
 (0)