diff options
author | George Rimar <grimar@accesssoftek.com> | 2019-08-08 07:17:35 +0000 |
---|---|---|
committer | George Rimar <grimar@accesssoftek.com> | 2019-08-08 07:17:35 +0000 |
commit | 67ea32a00709f5f2d999002d747c58ac357223fd (patch) | |
tree | 997907a1a6b02d74da239524972b3beacef356b7 /llvm/test/Object | |
parent | 6fd13f0849573aeec26f28ab0927eea0b5a7ccb9 (diff) | |
download | bcm5719-llvm-67ea32a00709f5f2d999002d747c58ac357223fd.tar.gz bcm5719-llvm-67ea32a00709f5f2d999002d747c58ac357223fd.zip |
[llvm-readobj/libObject] - Introduce a custom warning handler for `ELFFile<ELFT>` methods.
Currently, we have a code duplication in llvm-readobj which was introduced in D63266.
The duplication was introduced to allow llvm-readobj to dump the partially
broken object. Methods in ELFFile<ELFT> perform a strict validation of the inputs,
what is itself good, but not for dumper tools, that might want to dump the information,
even if some pieces are broken/unexpected.
This patch introduces a warning handler which can be passed to ELFFile<ELFT> methods
and can allow skipping the non-critical errors when needed/possible.
For demonstration, I removed the duplication from llvm-readobj and implemented a warning using
the new custom warning handler. It also deduplicates the strings printed, making the output less verbose.
Differential revision: https://reviews.llvm.org/D65515
llvm-svn: 368260
Diffstat (limited to 'llvm/test/Object')
-rw-r--r-- | llvm/test/Object/invalid.test | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/test/Object/invalid.test b/llvm/test/Object/invalid.test index 9086b87dda9..05f38e9d007 100644 --- a/llvm/test/Object/invalid.test +++ b/llvm/test/Object/invalid.test @@ -344,9 +344,9 @@ Sections: ## overflows the section name string table. # RUN: yaml2obj %s --docnum=17 -o %t17 -# RUN: not llvm-readobj --sections %t17 2>&1 | FileCheck --check-prefix=BROKEN-SECNAME %s +# RUN: not llvm-readobj --sections %t17 2>&1 | FileCheck -DFILE=%t17 --check-prefix=BROKEN-SECNAME %s -## BROKEN-SECNAME: error: a section [index 1] has an invalid sh_name (0x1) offset which goes past the end of the section name string table +## BROKEN-SECNAME: error: '[[FILE]]': a section [index 1] has an invalid sh_name (0x1) offset which goes past the end of the section name string table --- !ELF FileHeader: |