diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-08 22:00:09 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-01-08 22:00:09 +0000 |
commit | d28918b28996051a156f4ee0c11c884ea3cbcdc9 (patch) | |
tree | 578350222de8187727fd44d68fa3de7f0f5dcea1 | |
parent | 98f3de8880d4d387135b1a8407ba82d212b00862 (diff) | |
download | bcm5719-llvm-d28918b28996051a156f4ee0c11c884ea3cbcdc9.tar.gz bcm5719-llvm-d28918b28996051a156f4ee0c11c884ea3cbcdc9.zip |
Use getError instead of the error_code operator.
llvm-svn: 198797
-rw-r--r-- | lld/include/lld/Driver/CoreInputGraph.h | 3 | ||||
-rw-r--r-- | lld/include/lld/Driver/DarwinInputGraph.h | 4 | ||||
-rw-r--r-- | lld/lib/Core/InputGraph.cpp | 2 | ||||
-rw-r--r-- | lld/lib/Core/LinkingContext.cpp | 6 | ||||
-rw-r--r-- | lld/lib/Core/Resolver.cpp | 5 | ||||
-rw-r--r-- | lld/lib/Driver/GnuLdInputGraph.cpp | 8 | ||||
-rw-r--r-- | lld/lib/Driver/WinLinkInputGraph.cpp | 4 | ||||
-rw-r--r-- | lld/lib/ReaderWriter/ELF/DynamicFile.h | 4 | ||||
-rw-r--r-- | lld/lib/ReaderWriter/ELF/File.h | 32 | ||||
-rw-r--r-- | lld/lib/ReaderWriter/ELF/Reader.cpp | 4 | ||||
-rw-r--r-- | lld/lib/ReaderWriter/MachO/WriterMachO.cpp | 4 | ||||
-rw-r--r-- | lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp | 8 | ||||
-rw-r--r-- | lld/unittests/DriverTests/InputGraphTest.cpp | 92 |
13 files changed, 88 insertions, 88 deletions
diff --git a/lld/include/lld/Driver/CoreInputGraph.h b/lld/include/lld/Driver/CoreInputGraph.h index 9ad21134806..328f9150cdf 100644 --- a/lld/include/lld/Driver/CoreInputGraph.h +++ b/lld/include/lld/Driver/CoreInputGraph.h @@ -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 diff --git a/lld/include/lld/Driver/DarwinInputGraph.h b/lld/include/lld/Driver/DarwinInputGraph.h index 03ae1640c80..b3aeefc7add 100644 --- a/lld/include/lld/Driver/DarwinInputGraph.h +++ b/lld/include/lld/Driver/DarwinInputGraph.h @@ -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; diff --git a/lld/lib/Core/InputGraph.cpp b/lld/lib/Core/InputGraph.cpp index db77eb367e3..24dfbb532ac 100644 --- a/lld/lib/Core/InputGraph.cpp +++ b/lld/lib/Core/InputGraph.cpp @@ -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; } diff --git a/lld/lib/Core/LinkingContext.cpp b/lld/lib/Core/LinkingContext.cpp index 8a1ef257df1..5cb370a18bd 100644 --- a/lld/lib/Core/LinkingContext.cpp +++ b/lld/lib/Core/LinkingContext.cpp @@ -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; diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp index a889ee047cd..4673e77556b 100644 --- a/lld/lib/Core/Resolver.cpp +++ b/lld/lib/Core/Resolver.cpp @@ -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; } diff --git a/lld/lib/Driver/GnuLdInputGraph.cpp b/lld/lib/Driver/GnuLdInputGraph.cpp index 9a5bab4331c..9becadb5ed9 100644 --- a/lld/lib/Driver/GnuLdInputGraph.cpp +++ b/lld/lib/Driver/GnuLdInputGraph.cpp @@ -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 LinkingContext &ctx, 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; diff --git a/lld/lib/Driver/WinLinkInputGraph.cpp b/lld/lib/Driver/WinLinkInputGraph.cpp index 7db58628d05..60bfa47c1e6 100644 --- a/lld/lib/Driver/WinLinkInputGraph.cpp +++ b/lld/lib/Driver/WinLinkInputGraph.cpp @@ -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)) { diff --git a/lld/lib/ReaderWriter/ELF/DynamicFile.h b/lld/lib/ReaderWriter/ELF/DynamicFile.h index 2ba6dfdaa50..5b6d7578d7d 100644 --- a/lld/lib/ReaderWriter/ELF/DynamicFile.h +++ b/lld/lib/ReaderWriter/ELF/DynamicFile.h @@ -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) diff --git a/lld/lib/ReaderWriter/ELF/File.h b/lld/lib/ReaderWriter/ELF/File.h index dbf8a6f747a..b5726a6dc01 100644 --- a/lld/lib/ReaderWriter/ELF/File.h +++ b/lld/lib/ReaderWriter/ELF/File.h @@ -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; } diff --git a/lld/lib/ReaderWriter/ELF/Reader.cpp b/lld/lib/ReaderWriter/ELF/Reader.cpp index ccfd8ab80f2..ae4f9c34815 100644 --- a/lld/lib/ReaderWriter/ELF/Reader.cpp +++ b/lld/lib/ReaderWriter/ELF/Reader.cpp @@ -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(); } diff --git a/lld/lib/ReaderWriter/MachO/WriterMachO.cpp b/lld/lib/ReaderWriter/MachO/WriterMachO.cpp index ae739846f4e..009818a6798 100644 --- a/lld/lib/ReaderWriter/MachO/WriterMachO.cpp +++ b/lld/lib/ReaderWriter/MachO/WriterMachO.cpp @@ -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()); diff --git a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp index 4ae25adeb68..8e325e41fd5 100644 --- a/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp +++ b/lld/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp @@ -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. diff --git a/lld/unittests/DriverTests/InputGraphTest.cpp b/lld/unittests/DriverTests/InputGraphTest.cpp index 81bf06b9720..4663ffff8cf 100644 --- a/lld/unittests/DriverTests/InputGraphTest.cpp +++ b/lld/unittests/DriverTests/InputGraphTest.cpp @@ -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, AddAFileWithLLDFiles) { 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, AddAFileWithLLDFiles) { 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, AddNodeWithFilesAndGroup) { 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, AddNodeWithFilesAndGroup) { 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, AddNodeWithFilesAndGroup) { 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, AddNodeWithGroupIteration) { 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, AddNodeWithGroupIteration) { 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, AddNodeWithGroupIteration) { 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, ExpandInputGraphNode) { 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, ExpandAndReplaceInputGraphNode) { 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()); } } |