diff options
Diffstat (limited to 'tools/llvm-cov/TestingSupport.cpp')
-rw-r--r-- | tools/llvm-cov/TestingSupport.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tools/llvm-cov/TestingSupport.cpp b/tools/llvm-cov/TestingSupport.cpp index 16a1c2665299..3ee318c9c640 100644 --- a/tools/llvm-cov/TestingSupport.cpp +++ b/tools/llvm-cov/TestingSupport.cpp @@ -1,9 +1,8 @@ //===- TestingSupport.cpp - Convert objects files into test files --------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -70,9 +69,18 @@ int convertForTestingMain(int argc, const char *argv[]) { uint64_t ProfileNamesAddress = ProfileNames.getAddress(); StringRef CoverageMappingData; StringRef ProfileNamesData; - if (CoverageMapping.getContents(CoverageMappingData) || - ProfileNames.getContents(ProfileNamesData)) + if (Expected<StringRef> E = CoverageMapping.getContents()) + CoverageMappingData = *E; + else { + consumeError(E.takeError()); + return 1; + } + if (Expected<StringRef> E = ProfileNames.getContents()) + ProfileNamesData = *E; + else { + consumeError(E.takeError()); return 1; + } int FD; if (auto Err = sys::fs::openFileForWrite(OutputFilename, FD)) { |