forked from OSchip/llvm-project
Update error classes from all lowercase to camel case.
llvm-svn: 192261
This commit is contained in:
parent
1c1b443997
commit
c6015f6476
|
@ -20,7 +20,7 @@ namespace lld {
|
|||
|
||||
const llvm::error_category &native_reader_category();
|
||||
|
||||
enum class native_reader_error {
|
||||
enum class NativeReaderError {
|
||||
success = 0,
|
||||
unknown_file_format,
|
||||
file_too_short,
|
||||
|
@ -29,56 +29,56 @@ enum class native_reader_error {
|
|||
memory_error,
|
||||
};
|
||||
|
||||
inline llvm::error_code make_error_code(native_reader_error e) {
|
||||
inline llvm::error_code make_error_code(NativeReaderError e) {
|
||||
return llvm::error_code(static_cast<int>(e), native_reader_category());
|
||||
}
|
||||
|
||||
const llvm::error_category &yaml_reader_category();
|
||||
const llvm::error_category &YamlReaderCategory();
|
||||
|
||||
enum class yaml_reader_error {
|
||||
enum class YamlReaderError {
|
||||
success = 0,
|
||||
unknown_keyword,
|
||||
illegal_value
|
||||
};
|
||||
|
||||
inline llvm::error_code make_error_code(yaml_reader_error e) {
|
||||
return llvm::error_code(static_cast<int>(e), yaml_reader_category());
|
||||
inline llvm::error_code make_error_code(YamlReaderError e) {
|
||||
return llvm::error_code(static_cast<int>(e), YamlReaderCategory());
|
||||
}
|
||||
|
||||
const llvm::error_category &linker_script_reader_category();
|
||||
const llvm::error_category &LinkerScriptReaderCategory();
|
||||
|
||||
enum class linker_script_reader_error {
|
||||
enum class LinkerScriptReaderError {
|
||||
success = 0,
|
||||
parse_error
|
||||
};
|
||||
|
||||
inline llvm::error_code make_error_code(linker_script_reader_error e) {
|
||||
return llvm::error_code(static_cast<int>(e), linker_script_reader_category());
|
||||
inline llvm::error_code make_error_code(LinkerScriptReaderError e) {
|
||||
return llvm::error_code(static_cast<int>(e), LinkerScriptReaderCategory());
|
||||
}
|
||||
|
||||
/// \brief Errors returned by InputGraph functionality
|
||||
const llvm::error_category &input_graph_error_category();
|
||||
const llvm::error_category &InputGraphErrorCategory();
|
||||
|
||||
enum class input_graph_error {
|
||||
enum class InputGraphError {
|
||||
success = 0,
|
||||
failure = 1,
|
||||
no_more_elements,
|
||||
no_more_files
|
||||
};
|
||||
|
||||
inline llvm::error_code make_error_code(input_graph_error e) {
|
||||
return llvm::error_code(static_cast<int>(e), input_graph_error_category());
|
||||
inline llvm::error_code make_error_code(InputGraphError e) {
|
||||
return llvm::error_code(static_cast<int>(e), InputGraphErrorCategory());
|
||||
}
|
||||
|
||||
} // end namespace lld
|
||||
|
||||
namespace llvm {
|
||||
|
||||
template <> struct is_error_code_enum<lld::native_reader_error> : true_type {};
|
||||
template <> struct is_error_code_enum<lld::yaml_reader_error> : true_type {};
|
||||
template <> struct is_error_code_enum<lld::NativeReaderError> : true_type {};
|
||||
template <> struct is_error_code_enum<lld::YamlReaderError> : true_type {};
|
||||
template <>
|
||||
struct is_error_code_enum<lld::linker_script_reader_error> : true_type {};
|
||||
template <> struct is_error_code_enum<lld::input_graph_error> : true_type {};
|
||||
struct is_error_code_enum<lld::LinkerScriptReaderError> : true_type {};
|
||||
template <> struct is_error_code_enum<lld::InputGraphError> : true_type {};
|
||||
} // end namespace llvm
|
||||
|
||||
#endif
|
||||
|
|
|
@ -303,7 +303,7 @@ public:
|
|||
/// nextFile returns the next file that needs to be processed by the resolver.
|
||||
/// The LinkingContext's can override the default behavior to change the way
|
||||
/// the resolver operates. This uses the currentInputElement. When there are
|
||||
/// no more files to be processed an appropriate input_graph_error is
|
||||
/// no more files to be processed an appropriate InputGraphError is
|
||||
/// returned.
|
||||
virtual ErrorOr<File &> nextFile();
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
/// processed
|
||||
virtual ErrorOr<File &> getNextFile() {
|
||||
if (_files.size() == _nextFileIndex)
|
||||
return make_error_code(input_graph_error::no_more_files);
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
return *_files[_nextFileIndex++];
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
/// processed
|
||||
virtual ErrorOr<File &> getNextFile() {
|
||||
if (_files.size() == _nextFileIndex)
|
||||
return make_error_code(input_graph_error::no_more_files);
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
return *_files[_nextFileIndex++];
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
/// processed
|
||||
virtual ErrorOr<File &> getNextFile() {
|
||||
if (_nextFileIndex == _files.size())
|
||||
return make_error_code(input_graph_error::no_more_files);
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
return *_files[_nextFileIndex++];
|
||||
}
|
||||
|
||||
|
@ -175,7 +175,7 @@ public:
|
|||
bool again = false;
|
||||
// If there are no elements, move on to the next input element
|
||||
if (_elements.size() == 0)
|
||||
return make_error_code(input_graph_error::no_more_files);
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
// If we have processed all the elements as part of this node
|
||||
// check the resolver status for each input element and if the status
|
||||
// has not changed, move onto the next file.
|
||||
|
@ -187,7 +187,7 @@ public:
|
|||
}
|
||||
}
|
||||
if (!again)
|
||||
return make_error_code(input_graph_error::no_more_files);
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
_nextElementIndex = 0;
|
||||
// Reset the next file to be processed as part of each element
|
||||
for (auto &elem : _elements)
|
||||
|
@ -196,7 +196,7 @@ public:
|
|||
auto file = _elements[_nextElementIndex]->getNextFile();
|
||||
// Move on to the next element if we have finished processing all
|
||||
// the files in the input element
|
||||
if (error_code(file) == input_graph_error::no_more_files)
|
||||
if (error_code(file) == InputGraphError::no_more_files)
|
||||
_nextElementIndex++;
|
||||
else
|
||||
return *file;
|
||||
|
|
|
@ -381,7 +381,7 @@ public:
|
|||
|
||||
virtual ErrorOr<File &> getNextFile() {
|
||||
if (_nextFileIndex == _files.size())
|
||||
return make_error_code(input_graph_error::no_more_files);
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
return *_files[_nextFileIndex++];
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ public:
|
|||
|
||||
virtual ErrorOr<File &> getNextFile() {
|
||||
if (_nextFileIndex == _files.size())
|
||||
return make_error_code(input_graph_error::no_more_files);
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
return *_files[_nextFileIndex++];
|
||||
}
|
||||
|
||||
|
|
|
@ -13,117 +13,117 @@
|
|||
|
||||
using namespace lld;
|
||||
|
||||
class _native_reader_error_category : public llvm::_do_message {
|
||||
class _NativeReaderErrorCategory : public llvm::_do_message {
|
||||
public:
|
||||
virtual const char* name() const {
|
||||
return "lld.native.reader";
|
||||
}
|
||||
|
||||
virtual std::string message(int ev) const {
|
||||
if (native_reader_error(ev) == native_reader_error::success)
|
||||
if (NativeReaderError(ev) == NativeReaderError::success)
|
||||
return "Success";
|
||||
if (native_reader_error(ev) == native_reader_error::unknown_file_format)
|
||||
if (NativeReaderError(ev) == NativeReaderError::unknown_file_format)
|
||||
return "Unknown file format";
|
||||
if (native_reader_error(ev) == native_reader_error::file_too_short)
|
||||
if (NativeReaderError(ev) == NativeReaderError::file_too_short)
|
||||
return "file truncated";
|
||||
if (native_reader_error(ev) == native_reader_error::file_malformed)
|
||||
if (NativeReaderError(ev) == NativeReaderError::file_malformed)
|
||||
return "file malformed";
|
||||
if (native_reader_error(ev) == native_reader_error::memory_error)
|
||||
if (NativeReaderError(ev) == NativeReaderError::memory_error)
|
||||
return "out of memory";
|
||||
if (native_reader_error(ev) == native_reader_error::unknown_chunk_type)
|
||||
if (NativeReaderError(ev) == NativeReaderError::unknown_chunk_type)
|
||||
return "unknown chunk type";
|
||||
llvm_unreachable("An enumerator of native_reader_error does not have a "
|
||||
llvm_unreachable("An enumerator of NativeReaderError does not have a "
|
||||
"message defined.");
|
||||
}
|
||||
|
||||
virtual llvm::error_condition default_error_condition(int ev) const {
|
||||
if (native_reader_error(ev) == native_reader_error::success)
|
||||
if (NativeReaderError(ev) == NativeReaderError::success)
|
||||
return llvm::errc::success;
|
||||
return llvm::errc::invalid_argument;
|
||||
}
|
||||
};
|
||||
|
||||
const llvm::error_category &lld::native_reader_category() {
|
||||
static _native_reader_error_category o;
|
||||
static _NativeReaderErrorCategory o;
|
||||
return o;
|
||||
}
|
||||
|
||||
class _yaml_reader_error_category : public llvm::_do_message {
|
||||
class _YamlReaderErrorCategory : public llvm::_do_message {
|
||||
public:
|
||||
virtual const char* name() const {
|
||||
return "lld.yaml.reader";
|
||||
}
|
||||
|
||||
virtual std::string message(int ev) const {
|
||||
if (yaml_reader_error(ev) == yaml_reader_error::success)
|
||||
if (YamlReaderError(ev) == YamlReaderError::success)
|
||||
return "Success";
|
||||
if (yaml_reader_error(ev) == yaml_reader_error::unknown_keyword)
|
||||
if (YamlReaderError(ev) == YamlReaderError::unknown_keyword)
|
||||
return "Unknown keyword found in yaml file";
|
||||
if (yaml_reader_error(ev) == yaml_reader_error::illegal_value)
|
||||
if (YamlReaderError(ev) == YamlReaderError::illegal_value)
|
||||
return "Bad value found in yaml file";
|
||||
llvm_unreachable("An enumerator of yaml_reader_error does not have a "
|
||||
llvm_unreachable("An enumerator of YamlReaderError does not have a "
|
||||
"message defined.");
|
||||
}
|
||||
|
||||
virtual llvm::error_condition default_error_condition(int ev) const {
|
||||
if (yaml_reader_error(ev) == yaml_reader_error::success)
|
||||
if (YamlReaderError(ev) == YamlReaderError::success)
|
||||
return llvm::errc::success;
|
||||
return llvm::errc::invalid_argument;
|
||||
}
|
||||
};
|
||||
|
||||
const llvm::error_category &lld::yaml_reader_category() {
|
||||
static _yaml_reader_error_category o;
|
||||
const llvm::error_category &lld::YamlReaderCategory() {
|
||||
static _YamlReaderErrorCategory o;
|
||||
return o;
|
||||
}
|
||||
|
||||
class _linker_script_reader_error_category : public llvm::_do_message {
|
||||
class _LinkerScriptReaderErrorCategory : public llvm::_do_message {
|
||||
public:
|
||||
virtual const char *name() const { return "lld.linker-script.reader"; }
|
||||
|
||||
virtual std::string message(int ev) const {
|
||||
linker_script_reader_error e = linker_script_reader_error(ev);
|
||||
if (e == linker_script_reader_error::success)
|
||||
LinkerScriptReaderError e = LinkerScriptReaderError(ev);
|
||||
if (e == LinkerScriptReaderError::success)
|
||||
return "Success";
|
||||
if (e == linker_script_reader_error::parse_error)
|
||||
if (e == LinkerScriptReaderError::parse_error)
|
||||
return "Error parsing linker script";
|
||||
llvm_unreachable(
|
||||
"An enumerator of linker_script_reader_error does not have a "
|
||||
"An enumerator of LinkerScriptReaderError does not have a "
|
||||
"message defined.");
|
||||
}
|
||||
|
||||
virtual llvm::error_condition default_error_condition(int ev) const {
|
||||
linker_script_reader_error e = linker_script_reader_error(ev);
|
||||
if (e == linker_script_reader_error::success)
|
||||
LinkerScriptReaderError e = LinkerScriptReaderError(ev);
|
||||
if (e == LinkerScriptReaderError::success)
|
||||
return llvm::errc::success;
|
||||
return llvm::errc::invalid_argument;
|
||||
}
|
||||
};
|
||||
|
||||
const llvm::error_category &lld::linker_script_reader_category() {
|
||||
static _linker_script_reader_error_category o;
|
||||
const llvm::error_category &lld::LinkerScriptReaderCategory() {
|
||||
static _LinkerScriptReaderErrorCategory o;
|
||||
return o;
|
||||
}
|
||||
|
||||
class _input_graph_error_category : public llvm::_do_message {
|
||||
class _InputGraphErrorCategory : public llvm::_do_message {
|
||||
public:
|
||||
virtual const char *name() const { return "lld.inputGraph.parse"; }
|
||||
|
||||
virtual std::string message(int ev) const {
|
||||
if (input_graph_error(ev) == input_graph_error::success)
|
||||
if (InputGraphError(ev) == InputGraphError::success)
|
||||
return "Success";
|
||||
llvm_unreachable("An enumerator of input_graph_error does not have a "
|
||||
llvm_unreachable("An enumerator of InputGraphError does not have a "
|
||||
"message defined.");
|
||||
}
|
||||
|
||||
virtual llvm::error_condition default_error_condition(int ev) const {
|
||||
if (input_graph_error(ev) == input_graph_error::success)
|
||||
if (InputGraphError(ev) == InputGraphError::success)
|
||||
return llvm::errc::success;
|
||||
return llvm::errc::invalid_argument;
|
||||
}
|
||||
};
|
||||
|
||||
const llvm::error_category &lld::input_graph_error_category() {
|
||||
static _input_graph_error_category i;
|
||||
const llvm::error_category &lld::InputGraphErrorCategory() {
|
||||
static _InputGraphErrorCategory i;
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -85,8 +85,8 @@ ErrorOr<File &> LinkingContext::nextFile() {
|
|||
// initialized. Initialize it with the first element of the input graph.
|
||||
if (_currentInputElement == nullptr) {
|
||||
ErrorOr<InputElement *> elem = inputGraph().getNextInputElement();
|
||||
if (error_code(elem) == input_graph_error::no_more_elements)
|
||||
return make_error_code(input_graph_error::no_more_files);
|
||||
if (error_code(elem) == InputGraphError::no_more_elements)
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
_currentInputElement = *elem;
|
||||
}
|
||||
|
||||
|
@ -96,13 +96,13 @@ ErrorOr<File &> LinkingContext::nextFile() {
|
|||
// graph.
|
||||
for (;;) {
|
||||
ErrorOr<File &> nextFile = _currentInputElement->getNextFile();
|
||||
if (error_code(nextFile) != input_graph_error::no_more_files)
|
||||
if (error_code(nextFile) != InputGraphError::no_more_files)
|
||||
return std::move(nextFile);
|
||||
|
||||
ErrorOr<InputElement *> elem = inputGraph().getNextInputElement();
|
||||
if (error_code(elem) == input_graph_error::no_more_elements ||
|
||||
if (error_code(elem) == InputGraphError::no_more_elements ||
|
||||
*elem == nullptr)
|
||||
return make_error_code(input_graph_error::no_more_files);
|
||||
return make_error_code(InputGraphError::no_more_files);
|
||||
_currentInputElement = *elem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -292,7 +292,7 @@ void Resolver::resolveUndefines() {
|
|||
ScopedTask task(getDefaultDomain(), "resolveUndefines");
|
||||
|
||||
while (ErrorOr<File &> nextFile = _context.nextFile()) {
|
||||
if (error_code(nextFile) == input_graph_error::no_more_files)
|
||||
if (error_code(nextFile) == InputGraphError::no_more_files)
|
||||
break;
|
||||
if (nextFile->kind() == File::kindObject)
|
||||
handleFile(*nextFile);
|
||||
|
|
|
@ -77,7 +77,7 @@ void InputGraph::insertOneElementAt(std::unique_ptr<InputElement> element,
|
|||
/// \brief Helper functions for the resolver
|
||||
ErrorOr<InputElement *> InputGraph::getNextInputElement() {
|
||||
if (_nextElementIndex >= _inputArgs.size())
|
||||
return make_error_code(input_graph_error::no_more_elements);
|
||||
return make_error_code(InputGraphError::no_more_elements);
|
||||
return _inputArgs[_nextElementIndex++].get();
|
||||
}
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ CoreLinkingContext::relocKindFromString(StringRef str) const {
|
|||
if (str.equals(p->string))
|
||||
return p->value;
|
||||
}
|
||||
return make_error_code(yaml_reader_error::illegal_value);
|
||||
return make_error_code(YamlReaderError::illegal_value);
|
||||
}
|
||||
|
||||
ErrorOr<std::string>
|
||||
|
@ -307,5 +307,5 @@ CoreLinkingContext::stringFromRelocKind(Reference::Kind kind) const {
|
|||
if (kind == p->value)
|
||||
return std::string(p->string);
|
||||
}
|
||||
return make_error_code(yaml_reader_error::illegal_value);
|
||||
return make_error_code(YamlReaderError::illegal_value);
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ elf::HexagonLinkingContext::relocKindFromString(StringRef str) const {
|
|||
LLD_CASE(R_HEX_TPREL_16_X) LLD_CASE(R_HEX_TPREL_11_X).Default(-1);
|
||||
|
||||
if (ret == -1)
|
||||
return make_error_code(yaml_reader_error::illegal_value);
|
||||
return make_error_code(YamlReaderError::illegal_value);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -248,5 +248,5 @@ elf::HexagonLinkingContext::stringFromRelocKind(int32_t kind) const {
|
|||
LLD_CASE(R_HEX_TPREL_11_X)
|
||||
}
|
||||
|
||||
return make_error_code(yaml_reader_error::illegal_value);
|
||||
return make_error_code(YamlReaderError::illegal_value);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ elf::PPCLinkingContext::relocKindFromString(StringRef str) const {
|
|||
LLD_CASE(R_PPC_ADDR32).Default(-1);
|
||||
|
||||
if (ret == -1)
|
||||
return make_error_code(yaml_reader_error::illegal_value);
|
||||
return make_error_code(YamlReaderError::illegal_value);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -32,5 +32,5 @@ elf::PPCLinkingContext::stringFromRelocKind(Reference::Kind kind) const {
|
|||
LLD_CASE(R_PPC_ADDR32)
|
||||
}
|
||||
|
||||
return make_error_code(yaml_reader_error::illegal_value);
|
||||
return make_error_code(YamlReaderError::illegal_value);
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ elf::X86LinkingContext::relocKindFromString(StringRef str) const {
|
|||
LLD_CASE(R_386_PC32).Default(-1);
|
||||
|
||||
if (ret == -1)
|
||||
return make_error_code(yaml_reader_error::illegal_value);
|
||||
return make_error_code(YamlReaderError::illegal_value);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -32,5 +32,5 @@ elf::X86LinkingContext::stringFromRelocKind(Reference::Kind kind) const {
|
|||
LLD_CASE(R_386_PC32)
|
||||
}
|
||||
|
||||
return make_error_code(yaml_reader_error::illegal_value);
|
||||
return make_error_code(YamlReaderError::illegal_value);
|
||||
}
|
||||
|
|
|
@ -567,7 +567,7 @@ elf::X86_64LinkingContext::relocKindFromString(StringRef str) const {
|
|||
.Default(-1);
|
||||
|
||||
if (ret == -1)
|
||||
return make_error_code(yaml_reader_error::illegal_value);
|
||||
return make_error_code(YamlReaderError::illegal_value);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -622,6 +622,6 @@ elf::X86_64LinkingContext::stringFromRelocKind(Reference::Kind kind) const {
|
|||
return std::string("LLD_R_X86_64_GOTRELINDEX");
|
||||
}
|
||||
|
||||
return make_error_code(yaml_reader_error::illegal_value);
|
||||
return make_error_code(YamlReaderError::illegal_value);
|
||||
}
|
||||
|
||||
|
|
|
@ -622,7 +622,7 @@ readYaml(std::unique_ptr<MemoryBuffer> &mb) {
|
|||
|
||||
// Return error if there were parsing problems.
|
||||
if (yin.error())
|
||||
return make_error_code(lld::yaml_reader_error::illegal_value);
|
||||
return make_error_code(lld::YamlReaderError::illegal_value);
|
||||
|
||||
// Hand ownership of instantiated NormalizedFile to caller.
|
||||
return std::move(f);
|
||||
|
|
|
@ -261,12 +261,12 @@ public:
|
|||
reinterpret_cast<const NativeChunk *>(base + sizeof(NativeFileHeader));
|
||||
// make sure magic matches
|
||||
if ( memcmp(header->magic, NATIVE_FILE_HEADER_MAGIC, 16) != 0 )
|
||||
return make_error_code(native_reader_error::unknown_file_format);
|
||||
return make_error_code(NativeReaderError::unknown_file_format);
|
||||
|
||||
// make sure mapped file contains all needed data
|
||||
const size_t fileSize = mb->getBufferSize();
|
||||
if (header->fileSize > fileSize)
|
||||
return make_error_code(native_reader_error::file_too_short);
|
||||
return make_error_code(NativeReaderError::file_too_short);
|
||||
|
||||
DEBUG_WITH_TYPE("ReaderNative",
|
||||
llvm::dbgs() << " Native File Header:" << " fileSize="
|
||||
|
@ -282,9 +282,9 @@ public:
|
|||
const NativeChunk* chunk = &chunks[i];
|
||||
// sanity check chunk is within file
|
||||
if ( chunk->fileOffset > fileSize )
|
||||
return make_error_code(native_reader_error::file_malformed);
|
||||
return make_error_code(NativeReaderError::file_malformed);
|
||||
if ( (chunk->fileOffset + chunk->fileSize) > fileSize)
|
||||
return make_error_code(native_reader_error::file_malformed);
|
||||
return make_error_code(NativeReaderError::file_malformed);
|
||||
// process chunk, based on signature
|
||||
switch ( chunk->signature ) {
|
||||
case NCS_DefinedAtomsV1:
|
||||
|
@ -321,7 +321,7 @@ public:
|
|||
ec = file->processStrings(base, chunk);
|
||||
break;
|
||||
default:
|
||||
return make_error_code(native_reader_error::unknown_chunk_type);
|
||||
return make_error_code(NativeReaderError::unknown_chunk_type);
|
||||
}
|
||||
if ( ec ) {
|
||||
return ec;
|
||||
|
@ -349,7 +349,7 @@ public:
|
|||
}
|
||||
|
||||
result.push_back(std::move(file));
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
}
|
||||
|
||||
virtual ~File() {
|
||||
|
@ -396,11 +396,11 @@ private:
|
|||
uint8_t* atomsStart = reinterpret_cast<uint8_t*>
|
||||
(operator new(atomsArraySize, std::nothrow));
|
||||
if (atomsStart == nullptr)
|
||||
return make_error_code(native_reader_error::memory_error);
|
||||
return make_error_code(NativeReaderError::memory_error);
|
||||
const size_t ivarElementSize = chunk->fileSize
|
||||
/ chunk->elementCount;
|
||||
if ( ivarElementSize != sizeof(NativeDefinedAtomIvarsV1) )
|
||||
return make_error_code(native_reader_error::file_malformed);
|
||||
return make_error_code(NativeReaderError::file_malformed);
|
||||
uint8_t* atomsEnd = atomsStart + atomsArraySize;
|
||||
const NativeDefinedAtomIvarsV1* ivarData =
|
||||
reinterpret_cast<const NativeDefinedAtomIvarsV1*>
|
||||
|
@ -420,7 +420,7 @@ private:
|
|||
<< " count=" << chunk->elementCount
|
||||
<< " chunkSize=" << chunk->fileSize
|
||||
<< "\n");
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
}
|
||||
|
||||
|
||||
|
@ -435,7 +435,7 @@ private:
|
|||
<< " count=" << chunk->elementCount
|
||||
<< " chunkSize=" << chunk->fileSize
|
||||
<< "\n");
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
}
|
||||
|
||||
// set up pointers to attributes array
|
||||
|
@ -448,7 +448,7 @@ private:
|
|||
<< " count=" << chunk->elementCount
|
||||
<< " chunkSize=" << chunk->fileSize
|
||||
<< "\n");
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
}
|
||||
|
||||
// instantiate array of UndefinedAtoms from v1 ivar data in file
|
||||
|
@ -459,11 +459,11 @@ private:
|
|||
uint8_t* atomsStart = reinterpret_cast<uint8_t*>
|
||||
(operator new(atomsArraySize, std::nothrow));
|
||||
if (atomsStart == nullptr)
|
||||
return make_error_code(native_reader_error::memory_error);
|
||||
return make_error_code(NativeReaderError::memory_error);
|
||||
const size_t ivarElementSize = chunk->fileSize
|
||||
/ chunk->elementCount;
|
||||
if ( ivarElementSize != sizeof(NativeUndefinedAtomIvarsV1) )
|
||||
return make_error_code(native_reader_error::file_malformed);
|
||||
return make_error_code(NativeReaderError::file_malformed);
|
||||
uint8_t* atomsEnd = atomsStart + atomsArraySize;
|
||||
const NativeUndefinedAtomIvarsV1* ivarData =
|
||||
reinterpret_cast<const NativeUndefinedAtomIvarsV1*>
|
||||
|
@ -483,7 +483,7 @@ private:
|
|||
<< " count=" << chunk->elementCount
|
||||
<< " chunkSize=" << chunk->fileSize
|
||||
<< "\n");
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
}
|
||||
|
||||
|
||||
|
@ -495,11 +495,11 @@ private:
|
|||
uint8_t* atomsStart = reinterpret_cast<uint8_t*>
|
||||
(operator new(atomsArraySize, std::nothrow));
|
||||
if (atomsStart == nullptr)
|
||||
return make_error_code(native_reader_error::memory_error);
|
||||
return make_error_code(NativeReaderError::memory_error);
|
||||
const size_t ivarElementSize = chunk->fileSize
|
||||
/ chunk->elementCount;
|
||||
if ( ivarElementSize != sizeof(NativeSharedLibraryAtomIvarsV1) )
|
||||
return make_error_code(native_reader_error::file_malformed);
|
||||
return make_error_code(NativeReaderError::file_malformed);
|
||||
uint8_t* atomsEnd = atomsStart + atomsArraySize;
|
||||
const NativeSharedLibraryAtomIvarsV1* ivarData =
|
||||
reinterpret_cast<const NativeSharedLibraryAtomIvarsV1*>
|
||||
|
@ -519,7 +519,7 @@ private:
|
|||
<< " count=" << chunk->elementCount
|
||||
<< " chunkSize=" << chunk->fileSize
|
||||
<< "\n");
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
}
|
||||
|
||||
|
||||
|
@ -531,11 +531,11 @@ private:
|
|||
uint8_t* atomsStart = reinterpret_cast<uint8_t*>
|
||||
(operator new(atomsArraySize, std::nothrow));
|
||||
if (atomsStart == nullptr)
|
||||
return make_error_code(native_reader_error::memory_error);
|
||||
return make_error_code(NativeReaderError::memory_error);
|
||||
const size_t ivarElementSize = chunk->fileSize
|
||||
/ chunk->elementCount;
|
||||
if ( ivarElementSize != sizeof(NativeAbsoluteAtomIvarsV1) )
|
||||
return make_error_code(native_reader_error::file_malformed);
|
||||
return make_error_code(NativeReaderError::file_malformed);
|
||||
uint8_t* atomsEnd = atomsStart + atomsArraySize;
|
||||
const NativeAbsoluteAtomIvarsV1* ivarData =
|
||||
reinterpret_cast<const NativeAbsoluteAtomIvarsV1*>
|
||||
|
@ -555,7 +555,7 @@ private:
|
|||
<< " count=" << chunk->elementCount
|
||||
<< " chunkSize=" << chunk->fileSize
|
||||
<< "\n");
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
}
|
||||
|
||||
|
||||
|
@ -565,17 +565,17 @@ private:
|
|||
error_code processReferencesV1(const uint8_t *base,
|
||||
const NativeChunk *chunk) {
|
||||
if ( chunk->elementCount == 0 )
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
const size_t refSize = sizeof(NativeReferenceV1);
|
||||
size_t refsArraySize = chunk->elementCount * refSize;
|
||||
uint8_t* refsStart = reinterpret_cast<uint8_t*>
|
||||
(operator new(refsArraySize, std::nothrow));
|
||||
if (refsStart == nullptr)
|
||||
return make_error_code(native_reader_error::memory_error);
|
||||
return make_error_code(NativeReaderError::memory_error);
|
||||
const size_t ivarElementSize = chunk->fileSize
|
||||
/ chunk->elementCount;
|
||||
if ( ivarElementSize != sizeof(NativeReferenceIvarsV1) )
|
||||
return make_error_code(native_reader_error::file_malformed);
|
||||
return make_error_code(NativeReaderError::file_malformed);
|
||||
uint8_t* refsEnd = refsStart + refsArraySize;
|
||||
const NativeReferenceIvarsV1* ivarData =
|
||||
reinterpret_cast<const NativeReferenceIvarsV1*>
|
||||
|
@ -595,7 +595,7 @@ private:
|
|||
<< " count=" << chunk->elementCount
|
||||
<< " chunkSize=" << chunk->fileSize
|
||||
<< "\n");
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
}
|
||||
|
||||
// set up pointers to target table
|
||||
|
@ -637,14 +637,14 @@ private:
|
|||
this->_targetsTable[i] = reinterpret_cast<const AbsoluteAtom*>(p);
|
||||
continue;
|
||||
}
|
||||
return make_error_code(native_reader_error::file_malformed);
|
||||
return make_error_code(NativeReaderError::file_malformed);
|
||||
}
|
||||
DEBUG_WITH_TYPE("ReaderNative", llvm::dbgs()
|
||||
<< " chunk Targets Table: "
|
||||
<< " count=" << chunk->elementCount
|
||||
<< " chunkSize=" << chunk->fileSize
|
||||
<< "\n");
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
}
|
||||
|
||||
|
||||
|
@ -659,7 +659,7 @@ private:
|
|||
<< " count=" << chunk->elementCount
|
||||
<< " chunkSize=" << chunk->fileSize
|
||||
<< "\n");
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
}
|
||||
|
||||
// set up pointers to string pool in file
|
||||
|
@ -671,7 +671,7 @@ private:
|
|||
<< " chunk Strings: "
|
||||
<< " chunkSize=" << chunk->fileSize
|
||||
<< "\n");
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
}
|
||||
|
||||
// set up pointers to content area in file
|
||||
|
@ -683,7 +683,7 @@ private:
|
|||
<< " chunk content: "
|
||||
<< " chunkSize=" << chunk->fileSize
|
||||
<< "\n");
|
||||
return make_error_code(native_reader_error::success);
|
||||
return make_error_code(NativeReaderError::success);
|
||||
}
|
||||
|
||||
StringRef string(uint32_t offset) const {
|
||||
|
|
|
@ -121,12 +121,12 @@ Writer &PECOFFLinkingContext::writer() const { return *_writer; }
|
|||
|
||||
ErrorOr<Reference::Kind>
|
||||
PECOFFLinkingContext::relocKindFromString(StringRef str) const {
|
||||
return make_error_code(yaml_reader_error::illegal_value);
|
||||
return make_error_code(YamlReaderError::illegal_value);
|
||||
}
|
||||
|
||||
ErrorOr<std::string>
|
||||
PECOFFLinkingContext::stringFromRelocKind(Reference::Kind kind) const {
|
||||
return make_error_code(yaml_reader_error::illegal_value);
|
||||
return make_error_code(YamlReaderError::illegal_value);
|
||||
}
|
||||
|
||||
void PECOFFLinkingContext::addPasses(PassManager &pm) const {
|
||||
|
|
|
@ -194,7 +194,7 @@ public:
|
|||
|
||||
// Check if the total size is valid.
|
||||
if (end - buf != sizeof(COFF::ImportHeader) + dataSize) {
|
||||
ec = make_error_code(native_reader_error::unknown_file_format);
|
||||
ec = make_error_code(NativeReaderError::unknown_file_format);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -312,7 +312,7 @@ error_code parseCOFFImportLibrary(const LinkingContext &targetInfo,
|
|||
// Error if the file is too small or does not start with the magic.
|
||||
if (end - buf < static_cast<ptrdiff_t>(sizeof(COFF::ImportHeader)) ||
|
||||
memcmp(buf, "\0\0\xFF\xFF", 4))
|
||||
return make_error_code(native_reader_error::unknown_file_format);
|
||||
return make_error_code(NativeReaderError::unknown_file_format);
|
||||
|
||||
error_code ec;
|
||||
auto file = std::unique_ptr<File>(
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
new LinkerScriptFile(context, std::move(mb)));
|
||||
file->_script = file->_parser.parse();
|
||||
if (!file->_script)
|
||||
return linker_script_reader_error::parse_error;
|
||||
return LinkerScriptReaderError::parse_error;
|
||||
return std::move(file);
|
||||
}
|
||||
|
||||
|
|
|
@ -1284,14 +1284,14 @@ public:
|
|||
|
||||
// Quit now if there were parsing errors.
|
||||
if (yin.error())
|
||||
return make_error_code(lld::yaml_reader_error::illegal_value);
|
||||
return make_error_code(lld::YamlReaderError::illegal_value);
|
||||
|
||||
for (const File *file : createdFiles) {
|
||||
// Note: parseFile() should return vector of *const* File
|
||||
File *f = const_cast<File *>(file);
|
||||
result.emplace_back(f);
|
||||
}
|
||||
return make_error_code(lld::yaml_reader_error::success);
|
||||
return make_error_code(lld::YamlReaderError::success);
|
||||
}
|
||||
};
|
||||
} // end namespace yaml
|
||||
|
|
Loading…
Reference in New Issue