[llvm] [memprof] Add YAML read/write support to llvm-profdata (PR #118915)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 7 19:49:29 PST 2024
================
@@ -0,0 +1,8 @@
+; REQUIRES: x86_64-linux
+; RUN: split-file %s %t
+; RUN: not llvm-profdata merge %t/memprof-invalid.yaml -o %t/memprof-invalid.indexed
+
+; Verify that the invalid YAML input results in an error.
----------------
kazutakahirata wrote:
Yes, we do get meaningful errors. Let's say we've misspelled `HeapProfileRecords:` as `BeepProfileRecords:`. Then we get:
```
$ ./path/to/bin/llvm-profdata merge --memprof-version=3 --output=/tmp/junk.memprof MemProf.yaml
YAML:2:1: error: missing required key 'HeapProfileRecords'
BeepProfileRecords:
^
warning: MemProf.yaml: The profile is empty.
error: no profile can be merged
```
Now, I must admit that I am not wiring the YAML error to a nonzero exit code. Instead, I'm returning a nonzero exit code on the empty profile. I'm planning to fix this with a follow-up patch.
https://github.com/llvm/llvm-project/pull/118915
More information about the llvm-commits
mailing list