From f1d8934d79db25ff8760d4e12fb9c29ef4eb066a Mon Sep 17 00:00:00 2001 From: Richard Barnes Date: Tue, 16 Jan 2024 07:06:34 -0800 Subject: [PATCH] Fix shadowed variable in fbpcf/mpc_std_lib/unified_data_process/data_processor/test/DataProcessorTest.cpp 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: palmje Differential Revision: D52582932 --- .../data_processor/test/DataProcessorTest.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fbpcf/mpc_std_lib/unified_data_process/data_processor/test/DataProcessorTest.cpp b/fbpcf/mpc_std_lib/unified_data_process/data_processor/test/DataProcessorTest.cpp index f206b137..72e9bad6 100644 --- a/fbpcf/mpc_std_lib/unified_data_process/data_processor/test/DataProcessorTest.cpp +++ b/fbpcf/mpc_std_lib/unified_data_process/data_processor/test/DataProcessorTest.cpp @@ -188,7 +188,7 @@ void testUdpEncryptionAndDecryptionObjects( plaintextDataInShards, size_t dataWidth, size_t outputSize, - const std::vector& indexes, + const std::vector& indexes_2, const std::vector& sizes) { udpEnc->prepareToProcessMyData(dataWidth); size_t myDataIndexOffset = 0; @@ -199,7 +199,7 @@ void testUdpEncryptionAndDecryptionObjects( myDataIndexOffset += plaintextDataInShards.at(i).size(); udpEnc->processMyData(plaintextDataInShards.at(i), u64indexes); }; - udpEnc->prepareToProcessPeerData(dataWidth, indexes); + udpEnc->prepareToProcessPeerData(dataWidth, indexes_2); for (size_t i = 0; i < sizes.size(); i++) { udpEnc->processPeerData(sizes.at(i)); } @@ -244,12 +244,12 @@ void testUdpEncryptionAndDecryptionObjects( auto task1 = [](std::unique_ptr udpEnc, std::unique_ptr> udpDec0, std::unique_ptr> udpDec1, - const std::vector& indexes, + const std::vector& indexes_2, const std::vector& sizes, const std::vector>>& plaintextDataInShards, size_t dataWidth) { - udpEnc->prepareToProcessPeerData(dataWidth, indexes); + udpEnc->prepareToProcessPeerData(dataWidth, indexes_2); for (size_t i = 0; i < sizes.size(); i++) { udpEnc->processPeerData(sizes.at(i)); }