Skip to content

Commit

Permalink
Revert "[lldb][NFC] Make ApplyObjcCastHack less scary"
Browse files Browse the repository at this point in the history
This reverts commit 21641a2.

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
  • Loading branch information
jimingham committed Sep 17, 2019
1 parent 4b23c24 commit 66e9f23
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 66e9f23

Please sign in to comment.