aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-cov/TestingSupport.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-20 20:50:12 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-20 20:50:12 +0000
commite6d1592492a3a379186bfb02bd0f4eda0669c0d5 (patch)
tree599ab169a01f1c86eda9adc774edaedde2f2db5b /tools/llvm-cov/TestingSupport.cpp
parent1a56a5ead7a2e84bee8240f5f6b033b5f1707154 (diff)
Diffstat (limited to 'tools/llvm-cov/TestingSupport.cpp')
-rw-r--r--tools/llvm-cov/TestingSupport.cpp20
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)) {