projects
/
oota-llvm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Don't return error_code from function that never fails.
[oota-llvm.git]
/
lib
/
Object
/
Object.cpp
diff --git
a/lib/Object/Object.cpp
b/lib/Object/Object.cpp
index 4d3478bc14f097baf5688b8805244b44cc029d57..6c4bd3cdb883ea6e45ec763231f1331e823e138f 100644
(file)
--- a/
lib/Object/Object.cpp
+++ b/
lib/Object/Object.cpp
@@
-64,9
+64,10
@@
LLVMObjectFileRef LLVMCreateObjectFile(LLVMMemoryBufferRef MemBuf) {
ErrorOr<std::unique_ptr<ObjectFile>> ObjOrErr(
ObjectFile::createObjectFile(Buf->getMemBufferRef()));
std::unique_ptr<ObjectFile> Obj;
ErrorOr<std::unique_ptr<ObjectFile>> ObjOrErr(
ObjectFile::createObjectFile(Buf->getMemBufferRef()));
std::unique_ptr<ObjectFile> Obj;
- if (ObjOrErr)
- Obj = std::move(ObjOrErr.get());
- auto *Ret = new OwningBinary<ObjectFile>(std::move(Obj), std::move(Buf));
+ if (!ObjOrErr)
+ return nullptr;
+
+ auto *Ret = new OwningBinary<ObjectFile>(std::move(ObjOrErr.get()), std::move(Buf));
return wrap(Ret);
}
return wrap(Ret);
}
@@
-131,10
+132,7
@@
const char *LLVMGetSectionName(LLVMSectionIteratorRef SI) {
}
uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI) {
}
uint64_t LLVMGetSectionSize(LLVMSectionIteratorRef SI) {
- uint64_t ret;
- if (std::error_code ec = (*unwrap(SI))->getSize(ret))
- report_fatal_error(ec.message());
- return ret;
+ return (*unwrap(SI))->getSize();
}
const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) {
}
const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) {
@@
-145,18
+143,12
@@
const char *LLVMGetSectionContents(LLVMSectionIteratorRef SI) {
}
uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI) {
}
uint64_t LLVMGetSectionAddress(LLVMSectionIteratorRef SI) {
- uint64_t ret;
- if (std::error_code ec = (*unwrap(SI))->getAddress(ret))
- report_fatal_error(ec.message());
- return ret;
+ return (*unwrap(SI))->getAddress();
}
LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI,
LLVMSymbolIteratorRef Sym) {
}
LLVMBool LLVMGetSectionContainsSymbol(LLVMSectionIteratorRef SI,
LLVMSymbolIteratorRef Sym) {
- bool ret;
- if (std::error_code ec = (*unwrap(SI))->containsSymbol(**unwrap(Sym), ret))
- report_fatal_error(ec.message());
- return ret;
+ return (*unwrap(SI))->containsSymbol(**unwrap(Sym));
}
// Section Relocation iterators
}
// Section Relocation iterators
@@
-195,10
+187,7
@@
uint64_t LLVMGetSymbolAddress(LLVMSymbolIteratorRef SI) {
}
uint64_t LLVMGetSymbolSize(LLVMSymbolIteratorRef SI) {
}
uint64_t LLVMGetSymbolSize(LLVMSymbolIteratorRef SI) {
- uint64_t ret;
- if (std::error_code ec = (*unwrap(SI))->getSize(ret))
- report_fatal_error(ec.message());
- return ret;
+ return (*unwrap(SI))->getCommonSize();
}
// RelocationRef accessors
}
// RelocationRef accessors
@@
-210,10
+199,7
@@
uint64_t LLVMGetRelocationAddress(LLVMRelocationIteratorRef RI) {
}
uint64_t LLVMGetRelocationOffset(LLVMRelocationIteratorRef RI) {
}
uint64_t LLVMGetRelocationOffset(LLVMRelocationIteratorRef RI) {
- uint64_t ret;
- if (std::error_code ec = (*unwrap(RI))->getOffset(ret))
- report_fatal_error(ec.message());
- return ret;
+ return (*unwrap(RI))->getOffset();
}
LLVMSymbolIteratorRef LLVMGetRelocationSymbol(LLVMRelocationIteratorRef RI) {
}
LLVMSymbolIteratorRef LLVMGetRelocationSymbol(LLVMRelocationIteratorRef RI) {
@@
-241,12
+227,6
@@
const char *LLVMGetRelocationTypeName(LLVMRelocationIteratorRef RI) {
// NOTE: Caller takes ownership of returned string.
const char *LLVMGetRelocationValueString(LLVMRelocationIteratorRef RI) {
// NOTE: Caller takes ownership of returned string.
const char *LLVMGetRelocationValueString(LLVMRelocationIteratorRef RI) {
- SmallVector<char, 0> ret;
- if (std::error_code ec = (*unwrap(RI))->getValueString(ret))
- report_fatal_error(ec.message());
-
- char *str = static_cast<char*>(malloc(ret.size()));
- std::copy(ret.begin(), ret.end(), str);
- return str;
+ return strdup("");
}
}