From b7d2d21a27b6c1da7f11fb54335c0b6d0c8764c5 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 16 May 2020 22:42:52 -0700 Subject: [PATCH] [llvm-xray] consumeError when trying big-endian Follow-up of rL341226. Fixes "Expected must be checked before access or destruction" --- lib/XRay/Trace.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/XRay/Trace.cpp b/lib/XRay/Trace.cpp index 4f107e1059c..5ceb269b6d1 100644 --- a/lib/XRay/Trace.cpp +++ b/lib/XRay/Trace.cpp @@ -410,6 +410,7 @@ Expected llvm::xray::loadTraceFile(StringRef Filename, bool Sort) { auto TraceOrError = loadTrace(LittleEndianDE, Sort); if (!TraceOrError) { DataExtractor BigEndianDE(Data, false, 8); + consumeError(TraceOrError.takeError()); TraceOrError = loadTrace(BigEndianDE, Sort); } return TraceOrError;