[NFC] Reorder ifs in BufferedStackTrace::UnwindImpl
authorVitaly Buka <vitalybuka@google.com>
Tue, 5 Mar 2019 04:36:49 +0000 (04:36 +0000)
committerVitaly Buka <vitalybuka@google.com>
Tue, 5 Mar 2019 04:36:49 +0000 (04:36 +0000)
llvm-svn: 355376

compiler-rt/lib/asan/asan_stack.cc

index 2c034623efb3f27e29a2c7a4e2b4a56296fb49da..664f0d056482a1a62237b317c5610436444e78d0 100644 (file)
@@ -38,20 +38,24 @@ void __sanitizer::BufferedStackTrace::UnwindImpl(
   Unwind(max_depth, pc, bp, context, 0, 0, false);
 #else
   AsanThread *t = GetCurrentThread();
-  if (t && !t->isUnwinding()) {
-    uptr stack_top = t->stack_top();
-    uptr stack_bottom = t->stack_bottom();
-    ScopedUnwinding unwind_scope(t);
-    if (SANITIZER_MIPS && !IsValidFrame(bp, stack_top, stack_bottom))
-      return;
-    if (StackTrace::WillUseFastUnwind(request_fast))
-      Unwind(max_depth, pc, bp, nullptr, stack_top, stack_bottom, true);
-    else
+  if (!t) {
+    if (!request_fast) {
+      /* If GetCurrentThread() has failed, try to do slow unwind anyways. */
       Unwind(max_depth, pc, bp, context, 0, 0, false);
-  } else if (!t && !request_fast) {
-    /* If GetCurrentThread() has failed, try to do slow unwind anyways. */
-    Unwind(max_depth, pc, bp, context, 0, 0, false);
+    }
+    return;
   }
+  if (t->isUnwinding())
+    return;
+  uptr stack_top = t->stack_top();
+  uptr stack_bottom = t->stack_bottom();
+  ScopedUnwinding unwind_scope(t);
+  if (SANITIZER_MIPS && !IsValidFrame(bp, stack_top, stack_bottom))
+    return;
+  if (StackTrace::WillUseFastUnwind(request_fast))
+    Unwind(max_depth, pc, bp, nullptr, stack_top, stack_bottom, true);
+  else
+    Unwind(max_depth, pc, bp, context, 0, 0, false);
 #endif // SANITIZER_WINDOWS
 }