From b5794ca90c4e1e236eb98bf84b3e3be5e31edc32 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Tue, 20 Jun 2017 01:38:56 +0000 Subject: [ProfileData] PR33517: Check for failure of symtab creation With PR33517, it became apparent that symbol table creation can fail when presented with malformed inputs. This patch makes that sort of error detectable, so llvm-cov etc. can fail more gracefully. Specifically, we now check that function names within the symbol table aren't empty. Testing: check-{llvm,clang,profile}, some unit test updates. llvm-svn: 305765 --- llvm/tools/llvm-profdata/llvm-profdata.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'llvm/tools/llvm-profdata') diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 4867acf7098..e9bc2de82bd 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -246,10 +246,12 @@ static void mergeInstrProfile(const WeightedFileVector &Inputs, exitWithError(std::move(WC->Err), WC->ErrWhence); InstrProfWriter &Writer = Contexts[0]->Writer; - if (OutputFormat == PF_Text) - Writer.writeText(Output); - else + if (OutputFormat == PF_Text) { + if (Error E = Writer.writeText(Output)) + exitWithError(std::move(E)); + } else { Writer.write(Output); + } } static sampleprof::SampleProfileFormat FormatMap[] = { -- cgit v1.2.3