diff options
author | Vedant Kumar <vsk@apple.com> | 2017-06-20 01:38:56 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2017-06-20 01:38:56 +0000 |
commit | b9454635c0f598c66402692e3e8370f263592b83 (patch) | |
tree | 8c460eb41fcb29a002af25fe7f743f0bc991d4bf /tools/llvm-profdata | |
parent | a4bbfa963d9307c386e2ad7e79bc38175ae29329 (diff) |
[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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305765 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-profdata')
-rw-r--r-- | tools/llvm-profdata/llvm-profdata.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/tools/llvm-profdata/llvm-profdata.cpp b/tools/llvm-profdata/llvm-profdata.cpp index 4867acf7098..e9bc2de82bd 100644 --- a/tools/llvm-profdata/llvm-profdata.cpp +++ b/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[] = { |