forked from OSchip/llvm-project
cleanup unreferenced functions
This is a mechanical cleanup of unused functions. In the case where the functions are referenced (in comment form), I've simply commented out the functions. A second pass to clean that up is warranted. The functions which are otherwise unused have been removed. Some of these were introduced in the initial commit and not in use prior to that point! NFC llvm-svn: 204310
This commit is contained in:
parent
2643b9053e
commit
a68f7b67f1
|
@ -28,6 +28,8 @@
|
|||
#include "lldb/Symbol/VariableList.h"
|
||||
#include "lldb/Target/Target.h"
|
||||
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
using namespace lldb;
|
||||
|
@ -62,14 +64,6 @@ CheckTargetForWatchpointOperations(Target *target, CommandReturnObject &result)
|
|||
return true;
|
||||
}
|
||||
|
||||
// FIXME: This doesn't seem to be the right place for this functionality.
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
static inline void StripLeadingSpaces(llvm::StringRef &Str)
|
||||
{
|
||||
while (!Str.empty() && isspace(Str[0]))
|
||||
Str = Str.substr(1);
|
||||
}
|
||||
|
||||
// Equivalent class: {"-", "to", "To", "TO"} of range specifier array.
|
||||
static const char* RSA[4] = { "-", "to", "To", "TO" };
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ ReadInt16(const unsigned char* ptr, offset_t offset)
|
|||
}
|
||||
|
||||
static inline uint32_t
|
||||
ReadInt32 (const unsigned char* ptr, offset_t offset)
|
||||
ReadInt32 (const unsigned char* ptr, offset_t offset = 0)
|
||||
{
|
||||
uint32_t value;
|
||||
memcpy (&value, ptr + offset, 4);
|
||||
|
@ -60,7 +60,7 @@ ReadInt32 (const unsigned char* ptr, offset_t offset)
|
|||
}
|
||||
|
||||
static inline uint64_t
|
||||
ReadInt64(const unsigned char* ptr, offset_t offset)
|
||||
ReadInt64(const unsigned char* ptr, offset_t offset = 0)
|
||||
{
|
||||
uint64_t value;
|
||||
memcpy (&value, ptr + offset, 8);
|
||||
|
@ -75,22 +75,6 @@ ReadInt16(const void* ptr)
|
|||
return value;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
ReadInt32 (const void* ptr)
|
||||
{
|
||||
uint32_t value;
|
||||
memcpy (&value, ptr, 4);
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline uint64_t
|
||||
ReadInt64(const void* ptr)
|
||||
{
|
||||
uint64_t value;
|
||||
memcpy (&value, ptr, 8);
|
||||
return value;
|
||||
}
|
||||
|
||||
static inline uint16_t
|
||||
ReadSwapInt16(const unsigned char* ptr, offset_t offset)
|
||||
{
|
||||
|
|
|
@ -766,28 +766,6 @@ AddStringSummary(TypeCategoryImpl::SharedPointer category_sp,
|
|||
category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
|
||||
}
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
static void
|
||||
AddScriptSummary(TypeCategoryImpl::SharedPointer category_sp,
|
||||
const char* funct_name,
|
||||
ConstString type_name,
|
||||
TypeSummaryImpl::Flags flags,
|
||||
bool regex = false)
|
||||
{
|
||||
|
||||
std::string code(" ");
|
||||
code.append(funct_name).append("(valobj,internal_dict)");
|
||||
|
||||
lldb::TypeSummaryImplSP summary_sp(new ScriptSummaryFormat(flags,
|
||||
funct_name,
|
||||
code.c_str()));
|
||||
if (regex)
|
||||
category_sp->GetRegexTypeSummariesContainer()->Add(RegularExpressionSP(new RegularExpression(type_name.AsCString())),summary_sp);
|
||||
else
|
||||
category_sp->GetTypeSummariesContainer()->Add(type_name, summary_sp);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef LLDB_DISABLE_PYTHON
|
||||
static void
|
||||
AddCXXSummary (TypeCategoryImpl::SharedPointer category_sp,
|
||||
|
|
|
@ -1440,43 +1440,43 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context,
|
|||
}
|
||||
}
|
||||
|
||||
static clang_type_t
|
||||
MaybePromoteToBlockPointerType
|
||||
(
|
||||
ASTContext *ast_context,
|
||||
clang_type_t candidate_type
|
||||
)
|
||||
{
|
||||
if (!candidate_type)
|
||||
return candidate_type;
|
||||
|
||||
QualType candidate_qual_type = QualType::getFromOpaquePtr(candidate_type);
|
||||
|
||||
const PointerType *candidate_pointer_type = dyn_cast<PointerType>(candidate_qual_type);
|
||||
|
||||
if (!candidate_pointer_type)
|
||||
return candidate_type;
|
||||
|
||||
QualType pointee_qual_type = candidate_pointer_type->getPointeeType();
|
||||
|
||||
const RecordType *pointee_record_type = dyn_cast<RecordType>(pointee_qual_type);
|
||||
|
||||
if (!pointee_record_type)
|
||||
return candidate_type;
|
||||
|
||||
RecordDecl *pointee_record_decl = pointee_record_type->getDecl();
|
||||
|
||||
if (!pointee_record_decl->isRecord())
|
||||
return candidate_type;
|
||||
|
||||
if (!pointee_record_decl->getName().startswith(llvm::StringRef("__block_literal_")))
|
||||
return candidate_type;
|
||||
|
||||
QualType generic_function_type = ast_context->getFunctionNoProtoType(ast_context->UnknownAnyTy);
|
||||
QualType block_pointer_type = ast_context->getBlockPointerType(generic_function_type);
|
||||
|
||||
return block_pointer_type.getAsOpaquePtr();
|
||||
}
|
||||
//static clang_type_t
|
||||
//MaybePromoteToBlockPointerType
|
||||
//(
|
||||
// ASTContext *ast_context,
|
||||
// clang_type_t candidate_type
|
||||
//)
|
||||
//{
|
||||
// if (!candidate_type)
|
||||
// return candidate_type;
|
||||
//
|
||||
// QualType candidate_qual_type = QualType::getFromOpaquePtr(candidate_type);
|
||||
//
|
||||
// const PointerType *candidate_pointer_type = dyn_cast<PointerType>(candidate_qual_type);
|
||||
//
|
||||
// if (!candidate_pointer_type)
|
||||
// return candidate_type;
|
||||
//
|
||||
// QualType pointee_qual_type = candidate_pointer_type->getPointeeType();
|
||||
//
|
||||
// const RecordType *pointee_record_type = dyn_cast<RecordType>(pointee_qual_type);
|
||||
//
|
||||
// if (!pointee_record_type)
|
||||
// return candidate_type;
|
||||
//
|
||||
// RecordDecl *pointee_record_decl = pointee_record_type->getDecl();
|
||||
//
|
||||
// if (!pointee_record_decl->isRecord())
|
||||
// return candidate_type;
|
||||
//
|
||||
// if (!pointee_record_decl->getName().startswith(llvm::StringRef("__block_literal_")))
|
||||
// return candidate_type;
|
||||
//
|
||||
// QualType generic_function_type = ast_context->getFunctionNoProtoType(ast_context->UnknownAnyTy);
|
||||
// QualType block_pointer_type = ast_context->getBlockPointerType(generic_function_type);
|
||||
//
|
||||
// return block_pointer_type.getAsOpaquePtr();
|
||||
//}
|
||||
|
||||
bool
|
||||
ClangExpressionDeclMap::GetVariableValue (VariableSP &var,
|
||||
|
|
|
@ -88,87 +88,6 @@ std::string GetBuiltinIncludePath(const char *Argv0) {
|
|||
return P.str();
|
||||
}
|
||||
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Main driver for Clang
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
static void LLVMErrorHandler(void *UserData, const std::string &Message) {
|
||||
DiagnosticsEngine &Diags = *static_cast<DiagnosticsEngine*>(UserData);
|
||||
|
||||
Diags.Report(diag::err_fe_error_backend) << Message;
|
||||
|
||||
// We cannot recover from llvm errors.
|
||||
assert(0);
|
||||
}
|
||||
|
||||
static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) {
|
||||
using namespace clang::frontend;
|
||||
|
||||
switch (CI.getFrontendOpts().ProgramAction) {
|
||||
default:
|
||||
llvm_unreachable("Invalid program action!");
|
||||
|
||||
case ASTDump: return new ASTDumpAction();
|
||||
case ASTPrint: return new ASTPrintAction();
|
||||
case ASTView: return new ASTViewAction();
|
||||
case DumpRawTokens: return new DumpRawTokensAction();
|
||||
case DumpTokens: return new DumpTokensAction();
|
||||
case EmitAssembly: return new EmitAssemblyAction();
|
||||
case EmitBC: return new EmitBCAction();
|
||||
case EmitHTML: return new HTMLPrintAction();
|
||||
case EmitLLVM: return new EmitLLVMAction();
|
||||
case EmitLLVMOnly: return new EmitLLVMOnlyAction();
|
||||
case EmitCodeGenOnly: return new EmitCodeGenOnlyAction();
|
||||
case EmitObj: return new EmitObjAction();
|
||||
case FixIt: return new FixItAction();
|
||||
case GeneratePCH: return new GeneratePCHAction();
|
||||
case GeneratePTH: return new GeneratePTHAction();
|
||||
case InitOnly: return new InitOnlyAction();
|
||||
case ParseSyntaxOnly: return new SyntaxOnlyAction();
|
||||
|
||||
case PluginAction: {
|
||||
for (FrontendPluginRegistry::iterator it =
|
||||
FrontendPluginRegistry::begin(), ie = FrontendPluginRegistry::end();
|
||||
it != ie; ++it) {
|
||||
if (it->getName() == CI.getFrontendOpts().ActionName) {
|
||||
std::unique_ptr<PluginASTAction> P(it->instantiate());
|
||||
if (!P->ParseArgs(CI, CI.getFrontendOpts().PluginArgs))
|
||||
return 0;
|
||||
return P.release();
|
||||
}
|
||||
}
|
||||
|
||||
CI.getDiagnostics().Report(diag::err_fe_invalid_plugin_name)
|
||||
<< CI.getFrontendOpts().ActionName;
|
||||
return 0;
|
||||
}
|
||||
|
||||
case PrintDeclContext: return new DeclContextPrintAction();
|
||||
case PrintPreamble: return new PrintPreambleAction();
|
||||
case PrintPreprocessedInput: return new PrintPreprocessedAction();
|
||||
case RewriteMacros: return new RewriteMacrosAction();
|
||||
case RewriteObjC: return new RewriteObjCAction();
|
||||
case RewriteTest: return new RewriteTestAction();
|
||||
//case RunAnalysis: return new AnalysisAction();
|
||||
case RunPreprocessorOnly: return new PreprocessOnlyAction();
|
||||
}
|
||||
}
|
||||
|
||||
static FrontendAction *CreateFrontendAction(CompilerInstance &CI) {
|
||||
// Create the underlying action.
|
||||
FrontendAction *Act = CreateFrontendBaseAction(CI);
|
||||
if (!Act)
|
||||
return 0;
|
||||
|
||||
// If there are any AST files to merge, create a frontend action
|
||||
// adaptor to perform the merge.
|
||||
if (!CI.getFrontendOpts().ASTMergeFiles.empty())
|
||||
Act = new ASTMergeAction(Act, CI.getFrontendOpts().ASTMergeFiles);
|
||||
|
||||
return Act;
|
||||
}
|
||||
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Implementation of ClangExpressionParser
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
|
|
@ -396,20 +396,20 @@ ApplyObjcCastHack(std::string &expr)
|
|||
// hopefully we'll figure out a way to #include the same environment as is
|
||||
// present in the original source file rather than try to hack specific type
|
||||
// definitions in as needed.
|
||||
static void
|
||||
ApplyUnicharHack(std::string &expr)
|
||||
{
|
||||
#define UNICHAR_HACK_FROM "unichar"
|
||||
#define UNICHAR_HACK_TO "unsigned short"
|
||||
|
||||
size_t from_offset;
|
||||
|
||||
while ((from_offset = expr.find(UNICHAR_HACK_FROM)) != expr.npos)
|
||||
expr.replace(from_offset, sizeof(UNICHAR_HACK_FROM) - 1, UNICHAR_HACK_TO);
|
||||
|
||||
#undef UNICHAR_HACK_TO
|
||||
#undef UNICHAR_HACK_FROM
|
||||
}
|
||||
//static void
|
||||
//ApplyUnicharHack(std::string &expr)
|
||||
//{
|
||||
//#define UNICHAR_HACK_FROM "unichar"
|
||||
//#define UNICHAR_HACK_TO "unsigned short"
|
||||
//
|
||||
// size_t from_offset;
|
||||
//
|
||||
// while ((from_offset = expr.find(UNICHAR_HACK_FROM)) != expr.npos)
|
||||
// expr.replace(from_offset, sizeof(UNICHAR_HACK_FROM) - 1, UNICHAR_HACK_TO);
|
||||
//
|
||||
//#undef UNICHAR_HACK_TO
|
||||
//#undef UNICHAR_HACK_FROM
|
||||
//}
|
||||
|
||||
bool
|
||||
ClangUserExpression::Parse (Stream &error_stream,
|
||||
|
|
|
@ -687,27 +687,6 @@ IRForTarget::CreateResultVariable (llvm::Function &llvm_function)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void DebugUsers(lldb_private::Log *log, Value *value, uint8_t depth)
|
||||
{
|
||||
if (!depth)
|
||||
return;
|
||||
|
||||
depth--;
|
||||
|
||||
if (log)
|
||||
log->Printf(" <Begin %d users>", value->getNumUses());
|
||||
|
||||
for (llvm::User *u : value->users())
|
||||
{
|
||||
if (log)
|
||||
log->Printf(" <Use %p> %s", u, PrintValue(u).c_str());
|
||||
DebugUsers(log, u, depth);
|
||||
}
|
||||
|
||||
if (log)
|
||||
log->Printf(" <End uses>");
|
||||
}
|
||||
|
||||
bool
|
||||
IRForTarget::RewriteObjCConstString (llvm::GlobalVariable *ns_str,
|
||||
llvm::GlobalVariable *cstr)
|
||||
|
|
|
@ -57,11 +57,6 @@ Condition::Signal ()
|
|||
return ::pthread_cond_signal (&m_condition);
|
||||
}
|
||||
|
||||
/* convert struct timeval to ms(milliseconds) */
|
||||
static unsigned long int tv2ms(struct timeval a) {
|
||||
return ((a.tv_sec * 1000) + (a.tv_usec / 1000));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// The Wait() function atomically blocks the current thread
|
||||
// waiting on the owned condition variable, and unblocks the mutex
|
||||
|
|
|
@ -1068,30 +1068,6 @@ Host::GetOSVersion
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
GetMacOSXProcessName (const ProcessInstanceInfoMatch *match_info_ptr,
|
||||
ProcessInstanceInfo &process_info)
|
||||
{
|
||||
if (process_info.ProcessIDIsValid())
|
||||
{
|
||||
char process_name[MAXCOMLEN * 2 + 1];
|
||||
int name_len = ::proc_name(process_info.GetProcessID(), process_name, MAXCOMLEN * 2);
|
||||
if (name_len == 0)
|
||||
return false;
|
||||
|
||||
if (match_info_ptr == NULL || NameMatches(process_name,
|
||||
match_info_ptr->GetNameMatchType(),
|
||||
match_info_ptr->GetProcessInfo().GetName()))
|
||||
{
|
||||
process_info.GetExecutableFile().SetFile (process_name, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
process_info.GetExecutableFile().Clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
GetMacOSXProcessCPUType (ProcessInstanceInfo &process_info)
|
||||
{
|
||||
|
|
|
@ -62,13 +62,6 @@ static ScriptInterpreter::SWIGPythonScriptKeyword_Target g_swig_run_script_keywo
|
|||
static ScriptInterpreter::SWIGPythonScriptKeyword_Frame g_swig_run_script_keyword_frame = NULL;
|
||||
static ScriptInterpreter::SWIGPython_GetDynamicSetting g_swig_plugin_get = NULL;
|
||||
|
||||
static int
|
||||
_check_and_flush (FILE *stream)
|
||||
{
|
||||
int prev_fail = ferror (stream);
|
||||
return fflush (stream) || prev_fail ? EOF : 0;
|
||||
}
|
||||
|
||||
static std::string
|
||||
ReadPythonBacktrace (PyObject* py_backtrace);
|
||||
|
||||
|
|
|
@ -708,27 +708,6 @@ GDBRemoteCommunicationServer::Handle_qSpeedTest (StringExtractorGDBRemote &packe
|
|||
return SendErrorResponse (7);
|
||||
}
|
||||
|
||||
|
||||
static void *
|
||||
AcceptPortFromInferior (void *arg)
|
||||
{
|
||||
const char *connect_url = (const char *)arg;
|
||||
ConnectionFileDescriptor file_conn;
|
||||
Error error;
|
||||
if (file_conn.Connect (connect_url, &error) == eConnectionStatusSuccess)
|
||||
{
|
||||
char pid_str[256];
|
||||
::memset (pid_str, 0, sizeof(pid_str));
|
||||
ConnectionStatus status;
|
||||
const size_t pid_str_len = file_conn.Read (pid_str, sizeof(pid_str), 0, status, NULL);
|
||||
if (pid_str_len > 0)
|
||||
{
|
||||
int pid = atoi (pid_str);
|
||||
return (void *)(intptr_t)pid;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
//
|
||||
//static bool
|
||||
//WaitForProcessToSIGSTOP (const lldb::pid_t pid, const int timeout_in_seconds)
|
||||
|
|
|
@ -166,8 +166,6 @@ namespace {
|
|||
|
||||
} // anonymous namespace end
|
||||
|
||||
static bool rand_initialized = false;
|
||||
|
||||
// TODO Randomly assigning a port is unsafe. We should get an unused
|
||||
// ephemeral port from the kernel and make sure we reserve it before passing
|
||||
// it to debugserver.
|
||||
|
@ -180,19 +178,22 @@ static bool rand_initialized = false;
|
|||
#define HIGH_PORT (49151u)
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) && defined(__arm__)
|
||||
static bool rand_initialized = false;
|
||||
|
||||
static inline uint16_t
|
||||
get_random_port ()
|
||||
{
|
||||
if (!rand_initialized)
|
||||
{
|
||||
time_t seed = time(NULL);
|
||||
|
||||
|
||||
rand_initialized = true;
|
||||
srand(seed);
|
||||
}
|
||||
return (rand() % (HIGH_PORT - LOW_PORT)) + LOW_PORT;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
lldb_private::ConstString
|
||||
ProcessGDBRemote::GetPluginNameStatic()
|
||||
|
|
|
@ -213,13 +213,6 @@ DWARFDebugInfo::ContainsCompileUnit (const DWARFCompileUnit *cu) const
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
static bool CompileUnitOffsetLessThan (const DWARFCompileUnitSP& a, const DWARFCompileUnitSP& b)
|
||||
{
|
||||
return a->GetOffset() < b->GetOffset();
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
CompareDWARFCompileUnitSPOffset (const void *key, const void *arrmem)
|
||||
{
|
||||
|
@ -278,15 +271,6 @@ DWARFDebugInfo::GetCompileUnitContainingDIE(dw_offset_t die_offset)
|
|||
return cu_sp;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Compare function DWARFDebugAranges::Range structures
|
||||
//----------------------------------------------------------------------
|
||||
static bool CompareDIEOffset (const DWARFDebugInfoEntry& die1, const DWARFDebugInfoEntry& die2)
|
||||
{
|
||||
return die1.GetOffset() < die2.GetOffset();
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// GetDIE()
|
||||
//
|
||||
|
@ -339,40 +323,6 @@ DWARFDebugInfo::GetDIEPtrContainingOffset(dw_offset_t die_offset, DWARFCompileUn
|
|||
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// DWARFDebugInfo_ParseCallback
|
||||
//
|
||||
// A callback function for the static DWARFDebugInfo::Parse() function
|
||||
// that gets parses all compile units and DIE's into an internate
|
||||
// representation for further modification.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
static dw_offset_t
|
||||
DWARFDebugInfo_ParseCallback
|
||||
(
|
||||
SymbolFileDWARF* dwarf2Data,
|
||||
DWARFCompileUnitSP& cu_sp,
|
||||
DWARFDebugInfoEntry* die,
|
||||
const dw_offset_t next_offset,
|
||||
const uint32_t curr_depth,
|
||||
void* userData
|
||||
)
|
||||
{
|
||||
DWARFDebugInfo* debug_info = (DWARFDebugInfo*)userData;
|
||||
DWARFCompileUnit* cu = cu_sp.get();
|
||||
if (die)
|
||||
{
|
||||
cu->AddDIE(*die);
|
||||
}
|
||||
else if (cu)
|
||||
{
|
||||
debug_info->AddCompileUnit(cu_sp);
|
||||
}
|
||||
|
||||
// Just return the current offset to parse the next CU or DIE entry
|
||||
return next_offset;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// AddCompileUnit
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -366,20 +366,6 @@ SymbolFileSymtab::FindFunctions(const RegularExpression& regex, bool include_inl
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int CountMethodArgs(const char *method_signature)
|
||||
{
|
||||
int num_args = 0;
|
||||
|
||||
for (const char *colon_pos = strchr(method_signature, ':');
|
||||
colon_pos != NULL;
|
||||
colon_pos = strchr(colon_pos + 1, ':'))
|
||||
{
|
||||
num_args++;
|
||||
}
|
||||
|
||||
return num_args;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
SymbolFileSymtab::FindTypes (const lldb_private::SymbolContext& sc,
|
||||
const lldb_private::ConstString &name,
|
||||
|
|
|
@ -1392,222 +1392,6 @@ ClangASTContext::CreateClassTemplateSpecializationType (ClassTemplateSpecializat
|
|||
return ClangASTType();
|
||||
}
|
||||
|
||||
static bool
|
||||
IsOperator (const char *name, OverloadedOperatorKind &op_kind)
|
||||
{
|
||||
if (name == NULL || name[0] == '\0')
|
||||
return false;
|
||||
|
||||
#define OPERATOR_PREFIX "operator"
|
||||
#define OPERATOR_PREFIX_LENGTH (sizeof (OPERATOR_PREFIX) - 1)
|
||||
|
||||
const char *post_op_name = NULL;
|
||||
|
||||
bool no_space = true;
|
||||
|
||||
if (::strncmp(name, OPERATOR_PREFIX, OPERATOR_PREFIX_LENGTH))
|
||||
return false;
|
||||
|
||||
post_op_name = name + OPERATOR_PREFIX_LENGTH;
|
||||
|
||||
if (post_op_name[0] == ' ')
|
||||
{
|
||||
post_op_name++;
|
||||
no_space = false;
|
||||
}
|
||||
|
||||
#undef OPERATOR_PREFIX
|
||||
#undef OPERATOR_PREFIX_LENGTH
|
||||
|
||||
// This is an operator, set the overloaded operator kind to invalid
|
||||
// in case this is a conversion operator...
|
||||
op_kind = NUM_OVERLOADED_OPERATORS;
|
||||
|
||||
switch (post_op_name[0])
|
||||
{
|
||||
default:
|
||||
if (no_space)
|
||||
return false;
|
||||
break;
|
||||
case 'n':
|
||||
if (no_space)
|
||||
return false;
|
||||
if (strcmp (post_op_name, "new") == 0)
|
||||
op_kind = OO_New;
|
||||
else if (strcmp (post_op_name, "new[]") == 0)
|
||||
op_kind = OO_Array_New;
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
if (no_space)
|
||||
return false;
|
||||
if (strcmp (post_op_name, "delete") == 0)
|
||||
op_kind = OO_Delete;
|
||||
else if (strcmp (post_op_name, "delete[]") == 0)
|
||||
op_kind = OO_Array_Delete;
|
||||
break;
|
||||
|
||||
case '+':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Plus;
|
||||
else if (post_op_name[2] == '\0')
|
||||
{
|
||||
if (post_op_name[1] == '=')
|
||||
op_kind = OO_PlusEqual;
|
||||
else if (post_op_name[1] == '+')
|
||||
op_kind = OO_PlusPlus;
|
||||
}
|
||||
break;
|
||||
|
||||
case '-':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Minus;
|
||||
else if (post_op_name[2] == '\0')
|
||||
{
|
||||
switch (post_op_name[1])
|
||||
{
|
||||
case '=': op_kind = OO_MinusEqual; break;
|
||||
case '-': op_kind = OO_MinusMinus; break;
|
||||
case '>': op_kind = OO_Arrow; break;
|
||||
}
|
||||
}
|
||||
else if (post_op_name[3] == '\0')
|
||||
{
|
||||
if (post_op_name[2] == '*')
|
||||
op_kind = OO_ArrowStar; break;
|
||||
}
|
||||
break;
|
||||
|
||||
case '*':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Star;
|
||||
else if (post_op_name[1] == '=' && post_op_name[2] == '\0')
|
||||
op_kind = OO_StarEqual;
|
||||
break;
|
||||
|
||||
case '/':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Slash;
|
||||
else if (post_op_name[1] == '=' && post_op_name[2] == '\0')
|
||||
op_kind = OO_SlashEqual;
|
||||
break;
|
||||
|
||||
case '%':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Percent;
|
||||
else if (post_op_name[1] == '=' && post_op_name[2] == '\0')
|
||||
op_kind = OO_PercentEqual;
|
||||
break;
|
||||
|
||||
|
||||
case '^':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Caret;
|
||||
else if (post_op_name[1] == '=' && post_op_name[2] == '\0')
|
||||
op_kind = OO_CaretEqual;
|
||||
break;
|
||||
|
||||
case '&':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Amp;
|
||||
else if (post_op_name[2] == '\0')
|
||||
{
|
||||
switch (post_op_name[1])
|
||||
{
|
||||
case '=': op_kind = OO_AmpEqual; break;
|
||||
case '&': op_kind = OO_AmpAmp; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case '|':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Pipe;
|
||||
else if (post_op_name[2] == '\0')
|
||||
{
|
||||
switch (post_op_name[1])
|
||||
{
|
||||
case '=': op_kind = OO_PipeEqual; break;
|
||||
case '|': op_kind = OO_PipePipe; break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case '~':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Tilde;
|
||||
break;
|
||||
|
||||
case '!':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Exclaim;
|
||||
else if (post_op_name[1] == '=' && post_op_name[2] == '\0')
|
||||
op_kind = OO_ExclaimEqual;
|
||||
break;
|
||||
|
||||
case '=':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Equal;
|
||||
else if (post_op_name[1] == '=' && post_op_name[2] == '\0')
|
||||
op_kind = OO_EqualEqual;
|
||||
break;
|
||||
|
||||
case '<':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Less;
|
||||
else if (post_op_name[2] == '\0')
|
||||
{
|
||||
switch (post_op_name[1])
|
||||
{
|
||||
case '<': op_kind = OO_LessLess; break;
|
||||
case '=': op_kind = OO_LessEqual; break;
|
||||
}
|
||||
}
|
||||
else if (post_op_name[3] == '\0')
|
||||
{
|
||||
if (post_op_name[2] == '=')
|
||||
op_kind = OO_LessLessEqual;
|
||||
}
|
||||
break;
|
||||
|
||||
case '>':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Greater;
|
||||
else if (post_op_name[2] == '\0')
|
||||
{
|
||||
switch (post_op_name[1])
|
||||
{
|
||||
case '>': op_kind = OO_GreaterGreater; break;
|
||||
case '=': op_kind = OO_GreaterEqual; break;
|
||||
}
|
||||
}
|
||||
else if (post_op_name[1] == '>' &&
|
||||
post_op_name[2] == '=' &&
|
||||
post_op_name[3] == '\0')
|
||||
{
|
||||
op_kind = OO_GreaterGreaterEqual;
|
||||
}
|
||||
break;
|
||||
|
||||
case ',':
|
||||
if (post_op_name[1] == '\0')
|
||||
op_kind = OO_Comma;
|
||||
break;
|
||||
|
||||
case '(':
|
||||
if (post_op_name[1] == ')' && post_op_name[2] == '\0')
|
||||
op_kind = OO_Call;
|
||||
break;
|
||||
|
||||
case '[':
|
||||
if (post_op_name[1] == ']' && post_op_name[2] == '\0')
|
||||
op_kind = OO_Subscript;
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
check_op_param (uint32_t op_kind, bool unary, bool binary, uint32_t num_params)
|
||||
{
|
||||
|
|
|
@ -4340,22 +4340,6 @@ IsOperator (const char *name, OverloadedOperatorKind &op_kind)
|
|||
return true;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
check_op_param (uint32_t op_kind, bool unary, bool binary, uint32_t num_params)
|
||||
{
|
||||
// Special-case call since it can take any number of operands
|
||||
if(op_kind == OO_Call)
|
||||
return true;
|
||||
|
||||
// The parameter count doens't include "this"
|
||||
if (num_params == 0)
|
||||
return unary;
|
||||
if (num_params == 1)
|
||||
return binary;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
clang::RecordDecl *
|
||||
ClangASTType::GetAsRecordDecl () const
|
||||
{
|
||||
|
|
|
@ -866,32 +866,6 @@ typedef struct
|
|||
addr_t match_offset;
|
||||
} SymbolSearchInfo;
|
||||
|
||||
static int
|
||||
SymbolWithFileAddress (SymbolSearchInfo *info, const uint32_t *index_ptr)
|
||||
{
|
||||
const Symbol *curr_symbol = info->symtab->SymbolAtIndex (index_ptr[0]);
|
||||
if (curr_symbol == NULL)
|
||||
return -1;
|
||||
|
||||
const addr_t info_file_addr = info->file_addr;
|
||||
|
||||
// lldb::Symbol::GetAddressRangePtr() will only return a non NULL address
|
||||
// range if the symbol has a section!
|
||||
if (curr_symbol->ValueIsAddress())
|
||||
{
|
||||
const addr_t curr_file_addr = curr_symbol->GetAddress().GetFileAddress();
|
||||
if (info_file_addr < curr_file_addr)
|
||||
return -1;
|
||||
if (info_file_addr > curr_file_addr)
|
||||
return +1;
|
||||
info->match_symbol = const_cast<Symbol *>(curr_symbol);
|
||||
info->match_index_ptr = index_ptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int
|
||||
SymbolWithClosestFileAddress (SymbolSearchInfo *info, const uint32_t *index_ptr)
|
||||
{
|
||||
|
@ -921,19 +895,6 @@ SymbolWithClosestFileAddress (SymbolSearchInfo *info, const uint32_t *index_ptr)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static SymbolSearchInfo
|
||||
FindIndexPtrForSymbolContainingAddress(Symtab* symtab, addr_t file_addr, const uint32_t* indexes, uint32_t num_indexes)
|
||||
{
|
||||
SymbolSearchInfo info = { symtab, file_addr, NULL, NULL, 0 };
|
||||
::bsearch (&info,
|
||||
indexes,
|
||||
num_indexes,
|
||||
sizeof(uint32_t),
|
||||
(ComparisonFunction)SymbolWithClosestFileAddress);
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Symtab::InitAddressIndexes()
|
||||
{
|
||||
|
|
|
@ -179,49 +179,6 @@ TypeList::Dump(Stream *s, bool show_context)
|
|||
}
|
||||
}
|
||||
|
||||
// depending on implementation details, type lookup might fail because of
|
||||
// embedded spurious namespace:: prefixes. this call strips them, paying
|
||||
// attention to the fact that a type might have namespace'd type names as
|
||||
// arguments to templates, and those must not be stripped off
|
||||
static bool
|
||||
GetTypeScopeAndBasename(const char* name_cstr, std::string &scope, std::string &basename, bool *exact_ptr)
|
||||
{
|
||||
// Protect against null c string.
|
||||
|
||||
if (name_cstr && name_cstr[0])
|
||||
{
|
||||
const char *basename_cstr = name_cstr;
|
||||
const char* namespace_separator = ::strstr (basename_cstr, "::");
|
||||
if (namespace_separator)
|
||||
{
|
||||
const char* template_arg_char = ::strchr (basename_cstr, '<');
|
||||
while (namespace_separator != NULL)
|
||||
{
|
||||
if (template_arg_char && namespace_separator > template_arg_char) // but namespace'd template arguments are still good to go
|
||||
break;
|
||||
basename_cstr = namespace_separator + 2;
|
||||
namespace_separator = strstr(basename_cstr, "::");
|
||||
}
|
||||
if (basename_cstr > name_cstr)
|
||||
{
|
||||
scope.assign (name_cstr, basename_cstr - name_cstr);
|
||||
if (scope.size() >= 2 && scope[0] == ':' && scope[1] == ':')
|
||||
{
|
||||
// The typename passed in started with "::" so make sure we only do exact matches
|
||||
if (exact_ptr)
|
||||
*exact_ptr = true;
|
||||
// Strip the leading "::" as this won't ever show in qualified typenames we get
|
||||
// from clang.
|
||||
scope.erase(0,2);
|
||||
}
|
||||
basename.assign (basename_cstr);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
TypeList::RemoveMismatchedTypes (const char *qualified_typename,
|
||||
bool exact_match)
|
||||
|
|
|
@ -166,17 +166,6 @@ ThreadPlanAssemblyTracer::TracingEnded ()
|
|||
m_register_values.clear();
|
||||
}
|
||||
|
||||
static void
|
||||
PadOutTo (StreamString &stream, int target)
|
||||
{
|
||||
stream.Flush();
|
||||
|
||||
int length = stream.GetString().length();
|
||||
|
||||
if (length + 1 < target)
|
||||
stream.Printf("%*s", target - (length + 1) + 1, "");
|
||||
}
|
||||
|
||||
void
|
||||
ThreadPlanAssemblyTracer::Log ()
|
||||
{
|
||||
|
|
|
@ -63,16 +63,6 @@ xdigit_to_sint (char ch)
|
|||
return ch - '0';
|
||||
}
|
||||
|
||||
static inline unsigned int
|
||||
xdigit_to_uint (uint8_t ch)
|
||||
{
|
||||
if (ch >= 'a' && ch <= 'f')
|
||||
return 10u + ch - 'a';
|
||||
if (ch >= 'A' && ch <= 'F')
|
||||
return 10u + ch - 'A';
|
||||
return ch - '0';
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// StringExtractor constructor
|
||||
//----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue