Don't abort DeleteLocalRef for an argument to a method

This odd behavior is seen in clank.

Change-Id: Id7b0ae0d3504ab8f6228ac0f1b3bc6d62cc2bfc3
diff --git a/src/check_jni.cc b/src/check_jni.cc
index 554b56a..1e08022 100644
--- a/src/check_jni.cc
+++ b/src/check_jni.cc
@@ -63,6 +63,11 @@
  * ===========================================================================
  */
 
+static bool IsSirtLocalRef(JNIEnv* env, jobject localRef) {
+  return GetIndirectRefKind(localRef) == kSirtOrInvalid &&
+      reinterpret_cast<JNIEnvExt*>(env)->self->SirtContains(localRef);
+}
+
 template<typename T>
 T Decode(ScopedJniThreadState& ts, jobject obj) {
   return reinterpret_cast<T>(ts.Self()->DecodeJObject(obj));
@@ -1272,7 +1277,7 @@
 
   static void DeleteLocalRef(JNIEnv* env, jobject localRef) {
     CHECK_JNI_ENTRY(kFlag_Default | kFlag_ExcepOkay, "EL", env, localRef);
-    if (localRef != NULL && GetIndirectRefKind(localRef) != kLocal) {
+    if (localRef != NULL && GetIndirectRefKind(localRef) != kLocal && !IsSirtLocalRef(env, localRef)) {
       LOG(ERROR) << "JNI ERROR: DeleteLocalRef on " << GetIndirectRefKind(localRef) << ": " << localRef;
       JniAbort(__FUNCTION__);
     } else {