summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-profdata/llvm-profdata.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-06-20 01:38:56 +0000
committerVedant Kumar <vsk@apple.com>2017-06-20 01:38:56 +0000
commitb5794ca90c4e1e236eb98bf84b3e3be5e31edc32 (patch)
tree7d7fb893a3a2378d6547b904546f449d7f346fe5 /llvm/tools/llvm-profdata/llvm-profdata.cpp
parent4f05b362855cd10b35608a36b18a04647920309c (diff)
downloadbcm5719-llvm-b5794ca90c4e1e236eb98bf84b3e3be5e31edc32.tar.gz
bcm5719-llvm-b5794ca90c4e1e236eb98bf84b3e3be5e31edc32.zip
[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
Diffstat (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp')
-rw-r--r--llvm/tools/llvm-profdata/llvm-profdata.cpp8
1 files changed, 5 insertions, 3 deletions
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[] = {
OpenPOWER on IntegriCloud