forked from OSchip/llvm-project
Reland "[lldb][NFC] Make ApplyObjcCastHack less scary"
First version had a typo. llvm-svn: 372077
This commit is contained in:
parent
26a475afe5
commit
3ee98a1455
|
@ -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)["
|
||||
const std::string from = "(int)[";
|
||||
const 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, from.size(), to);
|
||||
}
|
||||
|
||||
bool ClangUserExpression::SetupPersistentState(DiagnosticManager &diagnostic_manager,
|
||||
|
|
Loading…
Reference in New Issue