Ran the sources through the compiler with -Wshadow warnings
enabled after we'd found a few bugs that were caused by shadowed
local variables; the most important issue this turned up was
a common mistake of trying to obtain a mutex lock for the scope
of a code block by doing
Mutex::Locker(m_map_mutex);
This doesn't assign the lock object to a local variable; it is
a temporary that has its dtor called immediately. Instead,
Mutex::Locker locker(m_map_mutex);
does what is intended. For some reason -Wshadow happened to
highlight these as shadowed variables.
I also fixed a few obivous and easy shadowed variable issues
across the code base but there are a couple dozen more that
should be fixed when someone has a free minute.
<rdar://problem/12437585>
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165269 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/OptionValueFileSpecLIst.cpp b/source/Interpreter/OptionValueFileSpecLIst.cpp
index 3328dc6..325460f 100644
--- a/source/Interpreter/OptionValueFileSpecLIst.cpp
+++ b/source/Interpreter/OptionValueFileSpecLIst.cpp
@@ -150,9 +150,9 @@
{
// Sort and then erase in reverse so indexes are always valid
std::sort(remove_indexes.begin(), remove_indexes.end());
- for (int i=num_remove_indexes-1; i<num_remove_indexes; ++i)
+ for (int j=num_remove_indexes-1; j<num_remove_indexes; ++j)
{
- m_current_value.Remove (i);
+ m_current_value.Remove (j);
}
}
}
diff --git a/source/Interpreter/OptionValuePathMappings.cpp b/source/Interpreter/OptionValuePathMappings.cpp
index d507b14..b594938 100644
--- a/source/Interpreter/OptionValuePathMappings.cpp
+++ b/source/Interpreter/OptionValuePathMappings.cpp
@@ -151,9 +151,9 @@
{
// Sort and then erase in reverse so indexes are always valid
std::sort(remove_indexes.begin(), remove_indexes.end());
- for (int i=num_remove_indexes-1; i<num_remove_indexes; ++i)
+ for (int j=num_remove_indexes-1; j<num_remove_indexes; ++j)
{
- m_path_mappings.Remove (i, m_notify_changes);
+ m_path_mappings.Remove (j, m_notify_changes);
}
}
}