blob: 1dc89fdd907e1fe4b7e286d6a3fdb84e9d960ed5 [file] [log] [blame]
// Copyright (c) 2022, the R8 project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
package com.android.tools.r8.utils;
import com.android.tools.r8.graph.DexDebugEvent;
import com.android.tools.r8.graph.DexDebugInfo;
import java.util.List;
public class DexDebugUtils {
public static boolean verifySetPositionFramesFollowedByDefaultEvent(DexDebugInfo debugInfo) {
return debugInfo == null
|| debugInfo.isPcBasedInfo()
|| verifySetPositionFramesFollowedByDefaultEvent(debugInfo.asEventBasedInfo().events);
}
public static boolean verifySetPositionFramesFollowedByDefaultEvent(List<DexDebugEvent> events) {
return verifySetPositionFramesFollowedByDefaultEvent(events.toArray(DexDebugEvent.EMPTY_ARRAY));
}
public static boolean verifySetPositionFramesFollowedByDefaultEvent(DexDebugEvent... events) {
for (int i = events.length - 1; i >= 0; i--) {
if (events[i].isDefaultEvent()) {
return true;
}
assert !events[i].isPositionFrame();
}
return true;
}
}