[lldb][NFC] Make ApplyObjcCastHack less scary

llvm-svn: 372017
This commit is contained in:
Raphael Isemann 2019-09-16 18:02:21 +00:00
parent 5e37d7f9ff
commit 21641a2f6d
1 changed files with 5 additions and 9 deletions

View File

@ -313,17 +313,13 @@ void ClangUserExpression::ScanContext(ExecutionContext &exe_ctx, Status &err) {
// count is not available, [myArray count] returns id, which can't be directly
// cast to int without causing a clang error.
static void ApplyObjcCastHack(std::string &expr) {
#define OBJC_CAST_HACK_FROM "(int)["
#define OBJC_CAST_HACK_TO "(int)(long long)["
std::string from = "(int)[";
std::string to = "(int)(long long)[";
size_t from_offset;
size_t offset;
while ((from_offset = expr.find(OBJC_CAST_HACK_FROM)) != expr.npos)
expr.replace(from_offset, sizeof(OBJC_CAST_HACK_FROM) - 1,
OBJC_CAST_HACK_TO);
#undef OBJC_CAST_HACK_TO
#undef OBJC_CAST_HACK_FROM
while ((offset = expr.find(from)) != expr.npos)
expr.replace(offset, to.size(), to);
}
bool ClangUserExpression::SetupPersistentState(DiagnosticManager &diagnostic_manager,