diff options
| author | George Rimar <grimar@accesssoftek.com> | 2019-08-14 11:10:11 +0000 |
|---|---|---|
| committer | George Rimar <grimar@accesssoftek.com> | 2019-08-14 11:10:11 +0000 |
| commit | bcc00e1afbdc107e05b2977fde26053a52295dd1 (patch) | |
| tree | 0ad3e328d73375164f99adb046a919273a128c1c /llvm/test/Object | |
| parent | a11d302fa00ba423b09c94491bc868cb991ff379 (diff) | |
| download | bcm5719-llvm-bcc00e1afbdc107e05b2977fde26053a52295dd1.tar.gz bcm5719-llvm-bcc00e1afbdc107e05b2977fde26053a52295dd1.zip | |
Recommit r368812 "[llvm/Object] - Convert SectionRef::getName() to return Expected<>"
Changes: no changes. A fix for the clang code will be landed right on top.
Original commit message:
SectionRef::getName() returns std::error_code now.
Returning Expected<> instead has multiple benefits.
For example, it forces user to check the error returned.
Also Expected<> may keep a valuable string error message,
what is more useful than having a error code.
(Object\invalid.test was updated to show the new messages printed.)
This patch makes a change for all users to switch to Expected<> version.
Note: in a few places the error returned was ignored before my changes.
In such places I left them ignored. My intention was to convert the interface
used, and not to improve and/or the existent users in this patch.
(Though I think this is good idea for a follow-ups to revisit such places
and either remove consumeError calls or comment each of them to clarify why
it is OK to have them).
Differential revision: https://reviews.llvm.org/D66089
llvm-svn: 368826
Diffstat (limited to 'llvm/test/Object')
| -rw-r--r-- | llvm/test/Object/invalid.test | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/llvm/test/Object/invalid.test b/llvm/test/Object/invalid.test index cddc0b9c342..16fae95df95 100644 --- a/llvm/test/Object/invalid.test +++ b/llvm/test/Object/invalid.test @@ -2,9 +2,9 @@ ## .shstrtab has an invalid type. # RUN: yaml2obj %s --docnum=1 -o %t1 -# RUN: not llvm-objdump -s %t1 2>&1 | FileCheck %s --check-prefix=INVALIDERR +# RUN: not llvm-objdump -s %t1 2>&1 | FileCheck %s -DFILE=%t1 --check-prefix=INVALID-SHTYPE -# INVALIDERR: error: reading file: Invalid data was encountered while parsing the file +# INVALID-SHTYPE: error: '[[FILE]]': invalid sh_type for string table section [index 1]: expected SHT_STRTAB, but got SHT_PROGBITS --- !ELF FileHeader: @@ -20,7 +20,9 @@ Sections: ## .shstrtab has an invalid zero-size. # RUN: yaml2obj %s --docnum=2 -o %t2 -# RUN: not llvm-objdump -s %t2 2>&1 | FileCheck %s --check-prefix=INVALIDERR +# RUN: not llvm-objdump -s %t2 2>&1 | FileCheck %s -DFILE=%t2 --check-prefix=STRTAB-EMPTY + +# STRTAB-EMPTY: error: '[[FILE]]': SHT_STRTAB string table section [index 1] is empty --- !ELF FileHeader: @@ -37,7 +39,9 @@ Sections: ## size that goes past the end of the file. # RUN: not llvm-objdump -s %p/Inputs/invalid-strtab-size.elf 2>&1 \ -# RUN: | FileCheck %s --check-prefix=INVALIDERR +# RUN: | FileCheck %s -DFILE=%p/Inputs/invalid-strtab-size.elf --check-prefix=INVALID-STRTAB-SIZE + +# INVALID-STRTAB-SIZE: error: '[[FILE]]': section [index 1] has a sh_offset (0x70) + sh_size (0x16777215) that cannot be represented ## Check that llvm-dwarfdump reports an error during relocation resolution ## when instead of expected SHT_RELA section it locates a section of a different type. @@ -72,7 +76,9 @@ Sections: ## and .shstrtab is not null-terminated. # RUN: yaml2obj %s --docnum=4 -o %t4 -# RUN: not llvm-objdump -s %t4 2>&1 | FileCheck --check-prefix=INVALIDERR %s +# RUN: not llvm-objdump -s %t4 2>&1 | FileCheck -DFILE=%t4 --check-prefix=SHSTRTAB-NON-TERM %s + +# SHSTRTAB-NON-TERM: error: '[[FILE]]': SHT_STRTAB string table section [index 1] is non-null terminated --- !ELF FileHeader: |

