Revert "[lldb][NFC] Make ApplyObjcCastHack less scary"

This reverts commit 21641a2f6d.

It was causing the following test failures:

lldb-Suite.lang/objc/objc-class-method.TestObjCClassMethod.py
lldb-Suite.lang/objc/foundation.TestObjCMethodsString.py
lldb-Suite.lang/objc/foundation.TestConstStrings.py
lldb-Suite.lang/objc/radar-9691614.TestObjCMethodReturningBOOL.py
lldb-Suite.lang/objc/foundation.TestObjCMethodsNSArray.py

llvm-svn: 372057
This commit is contained in:
Jim Ingham 2019-09-17 00:44:48 +00:00
parent 4b23c24bc8
commit 66e9f239b5
1 changed files with 9 additions and 5 deletions

View File

@ -313,13 +313,17 @@ 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) {
std::string from = "(int)[";
std::string to = "(int)(long long)[";
#define OBJC_CAST_HACK_FROM "(int)["
#define OBJC_CAST_HACK_TO "(int)(long long)["
size_t offset;
size_t from_offset;
while ((offset = expr.find(from)) != expr.npos)
expr.replace(offset, to.size(), to);
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
}
bool ClangUserExpression::SetupPersistentState(DiagnosticManager &diagnostic_manager,