[lld] r198797 - Use getError instead of the error_code operator.
Rafael Espindola
rafael.espindola at gmail.com
Wed Jan 8 14:00:10 PST 2014
Author: rafael
Date: Wed Jan 8 16:00:09 2014
New Revision: 198797
URL: http://llvm.org/viewvc/llvm-project?rev=198797&view=rev
Log:
Use getError instead of the error_code operator.
Modified:
lld/trunk/include/lld/Driver/CoreInputGraph.h
lld/trunk/include/lld/Driver/DarwinInputGraph.h
lld/trunk/lib/Core/InputGraph.cpp
lld/trunk/lib/Core/LinkingContext.cpp
lld/trunk/lib/Core/Resolver.cpp
lld/trunk/lib/Driver/GnuLdInputGraph.cpp
lld/trunk/lib/Driver/WinLinkInputGraph.cpp
lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h
lld/trunk/lib/ReaderWriter/ELF/File.h
lld/trunk/lib/ReaderWriter/ELF/Reader.cpp
lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp
lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
lld/trunk/unittests/DriverTests/InputGraphTest.cpp
Modified: lld/trunk/include/lld/Driver/CoreInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/CoreInputGraph.h?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/CoreInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/CoreInputGraph.h Wed Jan 8 16:00:09 2014
@@ -40,8 +40,7 @@ public:
/// \brief Parse the input file to lld::File.
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) {
ErrorOr<StringRef> filePath = getPath(ctx);
- if (!filePath &&
- error_code(filePath) == llvm::errc::no_such_file_or_directory)
+ if (filePath.getError() == llvm::errc::no_such_file_or_directory)
return make_error_code(llvm::errc::no_such_file_or_directory);
// Create a memory buffer
Modified: lld/trunk/include/lld/Driver/DarwinInputGraph.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Driver/DarwinInputGraph.h?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/include/lld/Driver/DarwinInputGraph.h (original)
+++ lld/trunk/include/lld/Driver/DarwinInputGraph.h Wed Jan 8 16:00:09 2014
@@ -40,8 +40,8 @@ public:
/// \brief Parse the input file to lld::File.
error_code parse(const LinkingContext &ctx, raw_ostream &diagnostics) {
ErrorOr<StringRef> filePath = getPath(ctx);
- if (!filePath)
- return error_code(filePath);
+ if (error_code ec = filePath.getError())
+ return ec;
if (error_code ec = getBuffer(*filePath))
return ec;
Modified: lld/trunk/lib/Core/InputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/InputGraph.cpp?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/lib/Core/InputGraph.cpp (original)
+++ lld/trunk/lib/Core/InputGraph.cpp Wed Jan 8 16:00:09 2014
@@ -202,7 +202,7 @@ ErrorOr<File &> Group::getNextFile() {
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) == InputGraphError::no_more_files) {
+ if (file.getError() == InputGraphError::no_more_files) {
_nextElementIndex++;
continue;
}
Modified: lld/trunk/lib/Core/LinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/LinkingContext.cpp?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/lib/Core/LinkingContext.cpp (original)
+++ lld/trunk/lib/Core/LinkingContext.cpp Wed Jan 8 16:00:09 2014
@@ -91,7 +91,7 @@ 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) == InputGraphError::no_more_elements)
+ if (elem.getError() == InputGraphError::no_more_elements)
return make_error_code(InputGraphError::no_more_files);
_currentInputElement = *elem;
}
@@ -102,11 +102,11 @@ ErrorOr<File &> LinkingContext::nextFile
// graph.
for (;;) {
ErrorOr<File &> nextFile = _currentInputElement->getNextFile();
- if (error_code(nextFile) != InputGraphError::no_more_files)
+ if (nextFile.getError() != InputGraphError::no_more_files)
return std::move(nextFile);
ErrorOr<InputElement *> elem = inputGraph().getNextInputElement();
- if (error_code(elem) == InputGraphError::no_more_elements ||
+ if (elem.getError() == InputGraphError::no_more_elements ||
*elem == nullptr)
return make_error_code(InputGraphError::no_more_files);
_currentInputElement = *elem;
Modified: lld/trunk/lib/Core/Resolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Core/Resolver.cpp?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/lib/Core/Resolver.cpp (original)
+++ lld/trunk/lib/Core/Resolver.cpp Wed Jan 8 16:00:09 2014
@@ -266,11 +266,12 @@ bool Resolver::resolveUndefines() {
for (;;) {
ErrorOr<File &> file = _context.nextFile();
_context.setResolverState(Resolver::StateNoChange);
- if (error_code(file) == InputGraphError::no_more_files)
+ error_code ec = file.getError();
+ if (ec == InputGraphError::no_more_files)
return true;
if (!file) {
llvm::errs() << "Error occurred in nextFile: "
- << error_code(file).message() << "\n";
+ << ec.message() << "\n";
return false;
}
Modified: lld/trunk/lib/Driver/GnuLdInputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/GnuLdInputGraph.cpp?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/lib/Driver/GnuLdInputGraph.cpp (original)
+++ lld/trunk/lib/Driver/GnuLdInputGraph.cpp Wed Jan 8 16:00:09 2014
@@ -16,8 +16,8 @@ using namespace lld;
error_code ELFFileNode::parse(const LinkingContext &ctx,
raw_ostream &diagnostics) {
ErrorOr<StringRef> filePath = getPath(ctx);
- if (!filePath)
- return error_code(filePath);
+ if (error_code ec = filePath.getError())
+ return ec;
if (error_code ec = getBuffer(*filePath))
return ec;
@@ -51,8 +51,8 @@ error_code ELFFileNode::parse(const Link
error_code GNULdScript::parse(const LinkingContext &ctx,
raw_ostream &diagnostics) {
ErrorOr<StringRef> filePath = getPath(ctx);
- if (!filePath)
- return error_code(filePath);
+ if (error_code ec = filePath.getError())
+ return ec;
if (error_code ec = getBuffer(*filePath))
return ec;
Modified: lld/trunk/lib/Driver/WinLinkInputGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/Driver/WinLinkInputGraph.cpp?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/lib/Driver/WinLinkInputGraph.cpp (original)
+++ lld/trunk/lib/Driver/WinLinkInputGraph.cpp Wed Jan 8 16:00:09 2014
@@ -15,9 +15,9 @@ namespace lld {
error_code PECOFFFileNode::parse(const LinkingContext &ctx,
raw_ostream &diagnostics) {
ErrorOr<StringRef> filePath = getPath(ctx);
- if (!filePath) {
+ if (error_code ec = filePath.getError()) {
diagnostics << "File not found: " << _path << "\n";
- return error_code(filePath);
+ return ec;
}
if (error_code ec = getBuffer(*filePath)) {
Modified: lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/DynamicFile.h Wed Jan 8 16:00:09 2014
@@ -48,8 +48,8 @@ public:
e = obj.end_dynamic_symbols();
i != e; ++i) {
auto name = obj.getSymbolName(i);
- if (!name)
- return error_code(name);
+ if (error_code ec = name.getError())
+ return ec;
// TODO: Add absolute symbols
if (i->st_shndx == llvm::ELF::SHN_ABS)
Modified: lld/trunk/lib/ReaderWriter/ELF/File.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/File.h?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/File.h (original)
+++ lld/trunk/lib/ReaderWriter/ELF/File.h Wed Jan 8 16:00:09 2014
@@ -208,8 +208,8 @@ public:
auto sHdr = _objFile->getSection(section->sh_info);
auto sectionName = _objFile->getSectionName(sHdr);
- if (!sectionName)
- return error_code(sectionName);
+ if (error_code ec = sectionName.getError())
+ return ec;
auto rai(_objFile->begin_rela(section));
auto rae(_objFile->end_rela(section));
@@ -222,8 +222,8 @@ public:
auto sHdr = _objFile->getSection(section->sh_info);
auto sectionName = _objFile->getSectionName(sHdr);
- if (!sectionName)
- return error_code(sectionName);
+ if (error_code ec = sectionName.getError())
+ return ec;
auto ri(_objFile->begin_rel(section));
auto re(_objFile->end_rel(section));
@@ -246,12 +246,12 @@ public:
std::vector<MergeString *> tokens;
for (const Elf_Shdr *msi : _mergeStringSections) {
auto sectionName = _objFile->getSectionName(msi);
- if (!sectionName)
- return error_code(sectionName);
+ if (error_code ec = sectionName.getError())
+ return ec;
auto sectionContents = _objFile->getSectionContents(msi);
- if (!sectionContents)
- return error_code(sectionContents);
+ if (error_code ec = sectionContents.getError())
+ return ec;
StringRef secCont(
reinterpret_cast<const char *>(sectionContents->begin()),
@@ -300,8 +300,8 @@ public:
const Elf_Shdr *section = _objFile->getSection(&*SymI);
auto symbolName = _objFile->getSymbolName(SymI);
- if (!symbolName)
- return error_code(symbolName);
+ if (error_code ec = symbolName.getError())
+ return ec;
if (SymI->st_shndx == llvm::ELF::SHN_ABS) {
// Create an absolute atom.
@@ -358,16 +358,16 @@ public:
auto sectionName = section ? _objFile->getSectionName(section)
: StringRef();
- if (!sectionName)
- return error_code(sectionName);
+ if (error_code ec = sectionName.getError())
+ return ec;
auto sectionContents =
(section && section->sh_type != llvm::ELF::SHT_NOBITS)
? _objFile->getSectionContents(section)
: ArrayRef<uint8_t>();
- if (!sectionContents)
- return error_code(sectionContents);
+ if (error_code ec = sectionContents.getError())
+ return ec;
StringRef secCont(
reinterpret_cast<const char *>(sectionContents->begin()),
@@ -391,8 +391,8 @@ public:
StringRef symbolName = "";
if (symbol->getType() != llvm::ELF::STT_SECTION) {
auto symName = _objFile->getSymbolName(symbol);
- if (!symName)
- return error_code(symName);
+ if (error_code ec = symName.getError())
+ return ec;
symbolName = *symName;
}
Modified: lld/trunk/lib/ReaderWriter/ELF/Reader.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/Reader.cpp?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/Reader.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/Reader.cpp Wed Jan 8 16:00:09 2014
@@ -120,8 +120,8 @@ public:
1ULL << llvm::countTrailingZeros(uintptr_t(mb->getBufferStart()));
auto f = createELF<DynamicFileCreateELFTraits>(
getElfArchType(&*mb), maxAlignment, std::move(mb), _useUndefines);
- if (!f)
- return f;
+ if (error_code ec = f.getError())
+ return ec;
result.push_back(std::move(*f));
return error_code::success();
}
Modified: lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp (original)
+++ lld/trunk/lib/ReaderWriter/MachO/WriterMachO.cpp Wed Jan 8 16:00:09 2014
@@ -36,8 +36,8 @@ public:
// Construct empty normalized file from atoms.
ErrorOr<std::unique_ptr<NormalizedFile>> nFile =
normalized::normalizedFromAtoms(file, _context);
- if (!nFile)
- return nFile;
+ if (error_code ec = nFile.getError())
+ return ec;
// For debugging, write out yaml form of normalized file.
//writeYaml(*nFile->get(), llvm::errs());
Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Wed Jan 8 16:00:09 2014
@@ -805,8 +805,8 @@ public:
std::vector<std::unique_ptr<File>> &result) const {
// Convert RC file to COFF
ErrorOr<std::string> coffPath = convertResourceFileToCOFF(std::move(mb));
- if (!coffPath)
- return error_code(coffPath);
+ if (error_code ec = coffPath.getError())
+ return ec;
llvm::FileRemover coffFileRemover(*coffPath);
// Read and parse the COFF
@@ -852,8 +852,8 @@ private:
convertResourceFileToCOFF(std::unique_ptr<MemoryBuffer> mb) {
// Write the resource file to a temporary file.
ErrorOr<std::string> inFilePath = writeResToTemporaryFile(std::move(mb));
- if (!inFilePath)
- return error_code(inFilePath);
+ if (error_code ec = inFilePath.getError())
+ return ec;
llvm::FileRemover inFileRemover(*inFilePath);
// Create an output file path.
Modified: lld/trunk/unittests/DriverTests/InputGraphTest.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/unittests/DriverTests/InputGraphTest.cpp?rev=198797&r1=198796&r2=198797&view=diff
==============================================================================
--- lld/trunk/unittests/DriverTests/InputGraphTest.cpp (original)
+++ lld/trunk/unittests/DriverTests/InputGraphTest.cpp Wed Jan 8 16:00:09 2014
@@ -144,7 +144,7 @@ protected:
TEST_F(InputGraphTest, Basic) {
EXPECT_EQ(0, inputFileCount());
ErrorOr<InputElement *> nextElement = inputGraph().getNextInputElement();
- EXPECT_EQ(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_EQ(InputGraphError::no_more_elements, nextElement.getError());
}
TEST_F(InputGraphTest, AddAFile) {
@@ -152,13 +152,13 @@ TEST_F(InputGraphTest, AddAFile) {
EXPECT_EQ(true, inputGraph().addInputElement(std::move(myfile)));
EXPECT_EQ(1, inputFileCount());
ErrorOr<InputElement *> nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
FileNode *fileNode = llvm::dyn_cast<FileNode>(*nextElement);
StringRef path = fileNode->getUserPath();
EXPECT_EQ(0, path.compare("file1"));
nextElement = inputGraph().getNextInputElement();
- EXPECT_EQ(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_EQ(InputGraphError::no_more_elements, nextElement.getError());
}
TEST_F(InputGraphTest, AddAFileWithLLDFiles) {
@@ -172,7 +172,7 @@ TEST_F(InputGraphTest, AddAFileWithLLDFi
EXPECT_EQ(true, inputGraph().addInputElement(std::move(myfile)));
EXPECT_EQ(1, inputFileCount());
ErrorOr<InputElement *> nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
FileNode *fileNode = llvm::dyn_cast<FileNode>(*nextElement);
@@ -180,24 +180,24 @@ TEST_F(InputGraphTest, AddAFileWithLLDFi
EXPECT_EQ(0, path.compare("multi_files"));
ErrorOr<File &> objfile = fileNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile1", (*objfile).path());
objfile = fileNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile2", (*objfile).path());
objfile = fileNode->getNextFile();
- EXPECT_EQ(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_EQ(InputGraphError::no_more_files, objfile.getError());
fileNode->resetNextIndex();
objfile = fileNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile1", (*objfile).path());
nextElement = inputGraph().getNextInputElement();
- EXPECT_EQ(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_EQ(InputGraphError::no_more_elements, nextElement.getError());
}
TEST_F(InputGraphTest, AddNodeWithFilesAndGroup) {
@@ -247,7 +247,7 @@ TEST_F(InputGraphTest, AddNodeWithFilesA
EXPECT_EQ(2, inputFileCount());
ErrorOr<InputElement *> nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
FileNode *fileNode = llvm::dyn_cast<FileNode>(*nextElement);
@@ -255,15 +255,15 @@ TEST_F(InputGraphTest, AddNodeWithFilesA
EXPECT_EQ(0, path.compare("multi_files1"));
ErrorOr<File &> objfile = fileNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile1", (*objfile).path());
objfile = fileNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile2", (*objfile).path());
objfile = fileNode->getNextFile();
- EXPECT_EQ(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_EQ(InputGraphError::no_more_files, objfile.getError());
nextElement = inputGraph().getNextInputElement();
EXPECT_EQ(InputElement::Kind::Control, (*nextElement)->kind());
@@ -272,23 +272,23 @@ TEST_F(InputGraphTest, AddNodeWithFilesA
EXPECT_EQ(ControlNode::ControlKind::Group, controlNode->controlKind());
objfile = controlNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile_1", (*objfile).path());
objfile = controlNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile_2", (*objfile).path());
objfile = controlNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("group_objfile1", (*objfile).path());
objfile = controlNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("group_objfile2", (*objfile).path());
nextElement = inputGraph().getNextInputElement();
- EXPECT_EQ(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_EQ(InputGraphError::no_more_elements, nextElement.getError());
}
// Iterate through the group
@@ -339,7 +339,7 @@ TEST_F(InputGraphTest, AddNodeWithGroupI
EXPECT_EQ(2, inputFileCount());
ErrorOr<InputElement *> nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
FileNode *fileNode = llvm::dyn_cast<FileNode>(*nextElement);
@@ -347,15 +347,15 @@ TEST_F(InputGraphTest, AddNodeWithGroupI
EXPECT_EQ(0, path.compare("multi_files1"));
ErrorOr<File &> objfile = fileNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile1", (*objfile).path());
objfile = fileNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile2", (*objfile).path());
objfile = fileNode->getNextFile();
- EXPECT_EQ(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_EQ(InputGraphError::no_more_files, objfile.getError());
nextElement = inputGraph().getNextInputElement();
EXPECT_EQ(InputElement::Kind::Control, (*nextElement)->kind());
@@ -364,37 +364,37 @@ TEST_F(InputGraphTest, AddNodeWithGroupI
EXPECT_EQ(ControlNode::ControlKind::Group, controlNode->controlKind());
objfile = controlNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile_1", (*objfile).path());
objfile = controlNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile_2", (*objfile).path());
objfile = controlNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("group_objfile1", (*objfile).path());
objfile = controlNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("group_objfile2", (*objfile).path());
controlNode->setResolveState(Resolver::StateNewDefinedAtoms);
objfile = controlNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile_1", (*objfile).path());
objfile = controlNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("objfile_2", (*objfile).path());
objfile = controlNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("group_objfile1", (*objfile).path());
objfile = controlNode->getNextFile();
- EXPECT_NE(InputGraphError::no_more_files, error_code(objfile));
+ EXPECT_NE(InputGraphError::no_more_files, objfile.getError());
EXPECT_EQ("group_objfile2", (*objfile).path());
}
@@ -443,37 +443,37 @@ TEST_F(InputGraphTest, ExpandInputGraphN
inputGraph().normalize();
ErrorOr<InputElement *> nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
FileNode *fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("multi_files1", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("expand_file1", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("expand_file2", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("expand_node", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("obj_after_expand", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_EQ(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_EQ(InputGraphError::no_more_elements, nextElement.getError());
}
// Node expansion tests.
@@ -521,31 +521,31 @@ TEST_F(InputGraphTest, ExpandAndReplaceI
inputGraph().normalize();
ErrorOr<InputElement *> nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
FileNode *fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("multi_files1", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("expand_file1", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("expand_file2", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("obj_after_expand", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_EQ(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_EQ(InputGraphError::no_more_elements, nextElement.getError());
}
// Hidden Node tests
@@ -593,31 +593,31 @@ TEST_F(InputGraphTest, HiddenNodeTests)
inputGraph().normalize();
ErrorOr<InputElement *> nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
FileNode *fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("multi_files1", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("expand_file1", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("expand_file2", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_NE(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_NE(InputGraphError::no_more_elements, nextElement.getError());
EXPECT_EQ(InputElement::Kind::File, (*nextElement)->kind());
fileNode = llvm::dyn_cast<FileNode>(*nextElement);
EXPECT_EQ("obj_after_expand", (*fileNode).getUserPath());
nextElement = inputGraph().getNextInputElement();
- EXPECT_EQ(InputGraphError::no_more_elements, error_code(nextElement));
+ EXPECT_EQ(InputGraphError::no_more_elements, nextElement.getError());
}
}
More information about the llvm-commits
mailing list