summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2019-03-05 04:36:49 +0000
committerVitaly Buka <vitalybuka@google.com>2019-03-05 04:36:49 +0000
commit4d9d2251ab00fd6e0c9cb26b3060acc5096eff1c (patch)
tree7eea9492295df7dba052f6ba35287d48adac06ee
parent81dbc02671b22375857aea0c11b7e57080590153 (diff)
downloadbcm5719-llvm-4d9d2251ab00fd6e0c9cb26b3060acc5096eff1c.tar.gz
bcm5719-llvm-4d9d2251ab00fd6e0c9cb26b3060acc5096eff1c.zip
[NFC] Reorder ifs in BufferedStackTrace::UnwindImpl
llvm-svn: 355376
-rw-r--r--compiler-rt/lib/asan/asan_stack.cc28
1 files changed, 16 insertions, 12 deletions
diff --git a/compiler-rt/lib/asan/asan_stack.cc b/compiler-rt/lib/asan/asan_stack.cc
index 2c034623efb..664f0d05648 100644
--- a/compiler-rt/lib/asan/asan_stack.cc
+++ b/compiler-rt/lib/asan/asan_stack.cc
@@ -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
}
OpenPOWER on IntegriCloud