mirror of
https://github.com/intel/llvm.git
synced 2026-01-27 06:06:34 +08:00
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>
llvm-svn: 165269
This commit is contained in:
@@ -97,15 +97,15 @@ DataBufferMemoryMap::Clear()
|
||||
// offset.
|
||||
//----------------------------------------------------------------------
|
||||
size_t
|
||||
DataBufferMemoryMap::MemoryMapFromFileSpec (const FileSpec* file,
|
||||
DataBufferMemoryMap::MemoryMapFromFileSpec (const FileSpec* filespec,
|
||||
off_t offset,
|
||||
size_t length,
|
||||
bool writeable)
|
||||
{
|
||||
if (file != NULL)
|
||||
if (filespec != NULL)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
if (file->GetPath(path, sizeof(path)))
|
||||
if (filespec->GetPath(path, sizeof(path)))
|
||||
{
|
||||
uint32_t options = File::eOpenOptionRead;
|
||||
if (writeable)
|
||||
|
||||
Reference in New Issue
Block a user