Fix all of the unannotated switch cases to annotate the fall through or do the right thing and break.

llvm-svn: 261950
This commit is contained in:
Greg Clayton 2016-02-26 01:20:20 +00:00
parent 5971f18133
commit cec91ef921
28 changed files with 92 additions and 103 deletions

View File

@ -1257,6 +1257,7 @@ cores_match (const ArchSpec::Core core1, const ArchSpec::Core core2, bool try_in
return true;
try_inverse = false;
}
break;
case ArchSpec::eCore_mips64:
if (!enforce_exact_match)
@ -1267,6 +1268,7 @@ cores_match (const ArchSpec::Core core1, const ArchSpec::Core core2, bool try_in
return true;
try_inverse = false;
}
break;
case ArchSpec::eCore_mips64el:
if (!enforce_exact_match)
@ -1277,6 +1279,7 @@ cores_match (const ArchSpec::Core core1, const ArchSpec::Core core2, bool try_in
return true;
try_inverse = false;
}
break;
case ArchSpec::eCore_mips64r2:
case ArchSpec::eCore_mips64r3:

View File

@ -2365,6 +2365,7 @@ private:
Write('(');
Write(m_read_ptr, m_read_end - m_read_ptr);
Write(')');
LLVM_FALLTHROUGH;
case '\0':
return true;
default:

View File

@ -239,16 +239,17 @@ RegisterValue::GetScalarValue (Scalar &scalar) const
{
case eTypeInvalid: break;
case eTypeBytes:
{
switch (buffer.length)
{
default: break;
case 1: scalar = *(const uint8_t *)buffer.bytes; return true;
case 2: scalar = *(const uint16_t *)buffer.bytes; return true;
case 4: scalar = *(const uint32_t *)buffer.bytes; return true;
case 8: scalar = *(const uint64_t *)buffer.bytes; return true;
switch (buffer.length)
{
default: break;
case 1: scalar = *(const uint8_t *)buffer.bytes; return true;
case 2: scalar = *(const uint16_t *)buffer.bytes; return true;
case 4: scalar = *(const uint32_t *)buffer.bytes; return true;
case 8: scalar = *(const uint64_t *)buffer.bytes; return true;
}
}
}
break;
case eTypeUInt8:
case eTypeUInt16:
case eTypeUInt32:

View File

@ -2630,6 +2630,7 @@ Scalar::ExtractBitfield (uint32_t bit_size,
case e_double:
result = SignedBits ((uint64_t )m_float.convertToDouble(), msbit, lsbit);
m_float = llvm::APFloat((double_t)result);
return true;
case e_long_double:
m_integer = m_float.bitcastToAPInt();
result = SignedBits (*m_integer.getRawData(), msbit, lsbit);

View File

@ -2797,6 +2797,7 @@ ValueObject::GetValueForExpressionPath_Impl(const char* expression_cstr,
}
expression_cstr++; // skip the -
}
LLVM_FALLTHROUGH;
case '.': // or fallthrough from ->
{
if (options.m_check_dot_vs_arrow_syntax && *expression_cstr == '.' &&

View File

@ -784,6 +784,7 @@ IRMemoryMap::GetMemoryData (DataExtractor &extractor, lldb::addr_t process_addre
return;
}
}
break;
case eAllocationPolicyHostOnly:
if (!allocation.m_data.GetByteSize())
{

View File

@ -185,14 +185,12 @@ SocketAddress::GetIPAddress () const
{
case AF_INET:
if (inet_ntop(GetFamily(), &m_socket_addr.sa_ipv4.sin_addr, str, sizeof(str)))
{
return str;
}
break;
case AF_INET6:
if (inet_ntop(GetFamily(), &m_socket_addr.sa_ipv6.sin6_addr, str, sizeof(str)))
{
return str;
}
break;
}
return "";
}

View File

@ -54,30 +54,32 @@ FileSystem::MakeDirectory(const FileSpec &file_spec, uint32_t file_permissions)
switch (error.GetError())
{
case ENOENT:
{
// Parent directory doesn't exist, so lets make it if we can
// Make the parent directory and try again
FileSpec parent_file_spec{file_spec.GetDirectory().GetCString(), false};
error = MakeDirectory(parent_file_spec, file_permissions);
if (error.Fail())
return error;
// Try and make the directory again now that the parent directory was made successfully
if (::mkdir(file_spec.GetCString(), file_permissions) == -1)
{
error.SetErrorToErrno();
// Parent directory doesn't exist, so lets make it if we can
// Make the parent directory and try again
FileSpec parent_file_spec{file_spec.GetDirectory().GetCString(), false};
error = MakeDirectory(parent_file_spec, file_permissions);
if (error.Fail())
return error;
// Try and make the directory again now that the parent directory was made successfully
if (::mkdir(file_spec.GetCString(), file_permissions) == -1)
{
error.SetErrorToErrno();
}
return error;
}
}
break;
case EEXIST:
{
if (file_spec.IsDirectory())
return Error{}; // It is a directory and it already exists
}
{
if (file_spec.IsDirectory())
return Error(); // It is a directory and it already exists
}
break;
}
}
return error;
}
return Error{"empty path"};
return Error("empty path");
}
Error

View File

@ -1625,6 +1625,7 @@ CommandInterpreter::PreprocessCommand (std::string &command)
break;
case eExpressionResultUnavailable:
error.SetErrorStringWithFormat ("expression error fetching result for the expression '%s'", expr_str.c_str());
break;
case eExpressionCompleted:
break;
case eExpressionDiscarded:

View File

@ -843,6 +843,7 @@ ABIMacOSX_arm::RegisterIsVolatile (const RegisterInfo *reg_info)
default:
break;
}
break;
case '4':
case '5':
case '6':
@ -878,30 +879,14 @@ ABIMacOSX_arm::RegisterIsVolatile (const RegisterInfo *reg_info)
break;
case '2':
switch (name[2])
{
case '\0':
return true; // s2 is volatile
default:
break;
}
break;
case '3':
switch (name[2])
{
case '\0':
return true; // s3 is volatile
default:
break;
}
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
return name[2] == '\0'; // s4 - s9 are volatile
return name[2] == '\0'; // s2 - s9 are volatile
default:
break;
@ -926,7 +911,8 @@ ABIMacOSX_arm::RegisterIsVolatile (const RegisterInfo *reg_info)
default:
break;
};
case '0':
break;
case '0':
case '2':
case '3':
return name[2] == '\0'; // q0-q3 are volatile

View File

@ -670,6 +670,7 @@ ABIMacOSX_arm64::RegisterIsVolatile (const RegisterInfo *reg_info)
case '3': // x30 aka lr treat as non-volatile
if (name[2] == '0')
return false;
break;
default:
return true;
}

View File

@ -915,6 +915,7 @@ ABISysV_arm::RegisterIsVolatile (const RegisterInfo *reg_info)
default:
break;
}
break;
case '4':
case '5':
case '6':
@ -950,30 +951,14 @@ ABISysV_arm::RegisterIsVolatile (const RegisterInfo *reg_info)
break;
case '2':
switch (name[2])
{
case '\0':
return true; // s2 is volatile
default:
break;
}
break;
case '3':
switch (name[2])
{
case '\0':
return true; // s3 is volatile
default:
break;
}
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
return name[2] == '\0'; // s4 - s9 are volatile
return name[2] == '\0'; // s2 - s9 are volatile
default:
break;
@ -996,9 +981,11 @@ ABISysV_arm::RegisterIsVolatile (const RegisterInfo *reg_info)
case '5':
return true; // q10-q15 are volatile
default:
break;
};
case '0':
return false;
}
break;
case '0':
case '2':
case '3':
return name[2] == '\0'; // q0-q3 are volatile

View File

@ -648,6 +648,7 @@ ABISysV_arm64::RegisterIsVolatile (const RegisterInfo *reg_info)
case '3': // x30 (lr) and x31 (sp) treat as non-volatile
if (name[2] == '0' || name[2] == '1')
return false;
break;
default:
return true; // all volatile cases not handled above fall here.
}

View File

@ -585,6 +585,7 @@ ClangModulesDeclVendorImpl::ForEachMacro(const ClangModulesDeclVendor::ModuleVec
break;
case clang::tok::TokenKind::raw_identifier:
macro_expansion.append(ti->getRawIdentifier().str());
break;
default:
macro_expansion.append(ti->getName());
break;

View File

@ -980,7 +980,7 @@ EmulateInstructionARM64::EmulateLDRSTRImm (const uint32_t opcode)
if (!WriteRegister (context, &reg_info_Rt, data_Rt))
return false;
break;
default:
return false;
}

View File

@ -531,6 +531,7 @@ lldb_private::formatters::NSNumberSummaryProvider (ValueObject& valobj, Stream&
break;
case 17: // 0B10001
data_location += 8;
LLVM_FALLTHROUGH;
case 4: // 0B0100
value = process_sp->ReadUnsignedIntegerFromMemory(data_location, 8, 0, error);
if (error.Fail())

View File

@ -2486,7 +2486,7 @@ RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id, const
// Write the file header
size_t num_bytes = sizeof(AllocationDetails::FileHeader);
if (log)
log->Printf("%s - writing File Header, 0x%" PRIx64 " bytes", __FUNCTION__, num_bytes);
log->Printf("%s - writing File Header, 0x%" PRIx64 " bytes", __FUNCTION__, (uint64_t)num_bytes);
Error err = file.Write(&head, num_bytes);
if (!err.Success())
@ -2500,7 +2500,7 @@ RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id, const
std::shared_ptr<uint8_t> element_header_buffer(new uint8_t[element_header_size]);
if (element_header_buffer == nullptr)
{
strm.Printf("Internal Error: Couldn't allocate %" PRIu64 " bytes on the heap", element_header_size);
strm.Printf("Internal Error: Couldn't allocate %" PRIu64 " bytes on the heap", (uint64_t)element_header_size);
strm.EOL();
return false;
}
@ -2510,7 +2510,7 @@ RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id, const
// Write headers for allocation element type to file
num_bytes = element_header_size;
if (log)
log->Printf("%s - writing element headers, 0x%" PRIx64 " bytes.", __FUNCTION__, num_bytes);
log->Printf("%s - writing element headers, 0x%" PRIx64 " bytes.", __FUNCTION__, (uint64_t)num_bytes);
err = file.Write(element_header_buffer.get(), num_bytes);
if (!err.Success())
@ -2523,7 +2523,7 @@ RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id, const
// Write allocation data to file
num_bytes = static_cast<size_t>(*alloc->size.get());
if (log)
log->Printf("%s - writing 0x%" PRIx64 " bytes", __FUNCTION__, num_bytes);
log->Printf("%s - writing 0x%" PRIx64 " bytes", __FUNCTION__, (uint64_t)num_bytes);
err = file.Write(buffer.get(), num_bytes);
if (!err.Success())

View File

@ -5120,6 +5120,7 @@ ObjectFileMachO::GetEntryPointAddress ()
start_address = text_segment_sp->GetFileAddress() + entryoffset;
}
}
break;
default:
break;

View File

@ -635,8 +635,7 @@ PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode (Target &target, BreakpointSite
return 0;
}
}
// Fall through...
LLVM_FALLTHROUGH;
default:
return Platform::GetSoftwareBreakpointTrapOpcode(target, bp_site);
}

View File

@ -3138,35 +3138,33 @@ ProcessGDBRemote::DoAllocateMemory (size_t size, uint32_t permissions, Error &er
Log *log (GetLogIfAnyCategoriesSet (LIBLLDB_LOG_PROCESS|LIBLLDB_LOG_EXPRESSIONS));
addr_t allocated_addr = LLDB_INVALID_ADDRESS;
LazyBool supported = m_gdb_comm.SupportsAllocDeallocMemory();
switch (supported)
if (m_gdb_comm.SupportsAllocDeallocMemory() != eLazyBoolNo)
{
case eLazyBoolCalculate:
case eLazyBoolYes:
allocated_addr = m_gdb_comm.AllocateMemory (size, permissions);
if (allocated_addr != LLDB_INVALID_ADDRESS || supported == eLazyBoolYes)
return allocated_addr;
allocated_addr = m_gdb_comm.AllocateMemory (size, permissions);
if (allocated_addr != LLDB_INVALID_ADDRESS || m_gdb_comm.SupportsAllocDeallocMemory() == eLazyBoolYes)
return allocated_addr;
}
case eLazyBoolNo:
// Call mmap() to create memory in the inferior..
unsigned prot = 0;
if (permissions & lldb::ePermissionsReadable)
prot |= eMmapProtRead;
if (permissions & lldb::ePermissionsWritable)
prot |= eMmapProtWrite;
if (permissions & lldb::ePermissionsExecutable)
prot |= eMmapProtExec;
if (m_gdb_comm.SupportsAllocDeallocMemory() == eLazyBoolNo)
{
// Call mmap() to create memory in the inferior..
unsigned prot = 0;
if (permissions & lldb::ePermissionsReadable)
prot |= eMmapProtRead;
if (permissions & lldb::ePermissionsWritable)
prot |= eMmapProtWrite;
if (permissions & lldb::ePermissionsExecutable)
prot |= eMmapProtExec;
if (InferiorCallMmap(this, allocated_addr, 0, size, prot,
eMmapFlagsAnon | eMmapFlagsPrivate, -1, 0))
m_addr_to_mmap_size[allocated_addr] = size;
else
{
allocated_addr = LLDB_INVALID_ADDRESS;
if (log)
log->Printf ("ProcessGDBRemote::%s no direct stub support for memory allocation, and InferiorCallMmap also failed - is stub missing register context save/restore capability?", __FUNCTION__);
}
break;
if (InferiorCallMmap(this, allocated_addr, 0, size, prot,
eMmapFlagsAnon | eMmapFlagsPrivate, -1, 0))
m_addr_to_mmap_size[allocated_addr] = size;
else
{
allocated_addr = LLDB_INVALID_ADDRESS;
if (log)
log->Printf ("ProcessGDBRemote::%s no direct stub support for memory allocation, and InferiorCallMmap also failed - is stub missing register context save/restore capability?", __FUNCTION__);
}
}
if (allocated_addr == LLDB_INVALID_ADDRESS)

View File

@ -277,6 +277,7 @@ DWARFASTParserClang::ParseTypeFromDWARF (const SymbolContext& sc,
if (type_sp)
return type_sp;
LLVM_FALLTHROUGH;
case DW_TAG_base_type:
case DW_TAG_pointer_type:
case DW_TAG_reference_type:

View File

@ -346,7 +346,8 @@ DWARFMappedHash::Header::Read (const lldb_private::DWARFDataExtractor &data,
case eAtomTypeTag: // DW_TAG value for the DIE
hash_data.tag = (dw_tag_t)form_value.Unsigned ();
break;
case eAtomTypeTypeFlags: // Flags from enum TypeFlags
hash_data.type_flags = (uint32_t)form_value.Unsigned ();
break;

View File

@ -547,8 +547,6 @@ ObjectFile::ReadSectionData (const Section *section, DataExtractor& section_data
// The object file now contains a full mmap'ed copy of the object file data, so just use this
return MemoryMapSectionData (section, section_data);
}
section_data.Clear();
return 0;
}
size_t

View File

@ -828,6 +828,7 @@ PrivateAutoComplete (StackFrame *frame,
word_complete);
}
}
break;
default:
break;
}
@ -864,6 +865,7 @@ PrivateAutoComplete (StackFrame *frame,
matches,
word_complete);
}
break;
default:
break;
}

View File

@ -187,6 +187,7 @@ StackFrameList::ResetCurrentInlinedDepth ()
break;
}
}
LLVM_FALLTHROUGH;
default:
{
// Otherwise, we should set ourselves at the container of the inlining, so that the

View File

@ -445,6 +445,7 @@ JSONParser::GetToken (std::string &value)
value = std::move(error.GetString());
return Token::Error;
}
break;
default:
done = true;

View File

@ -227,7 +227,7 @@ StringExtractorGDBRemote::GetServerPacketType () const
case 'j':
if (PACKET_MATCHES("jSignalsInfo")) return eServerPacketType_jSignalsInfo;
if (PACKET_MATCHES("jThreadsInfo")) return eServerPacketType_jThreadsInfo;
break;
case 'v':
if (PACKET_STARTS_WITH("vFile:"))

View File

@ -473,6 +473,7 @@ main_gdbserver (int argc, char *argv[])
case 'U': // unnamed pipe
if (optarg && optarg[0])
unnamed_pipe_fd = StringConvert::ToUInt32(optarg, -1);
break;
case 'r':
// Do nothing, native regs is the default these days