diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-11 19:05:55 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2014-06-11 19:05:55 +0000 |
commit | 534f692b4d1e6dd28dedebaee69a520fb1a73326 (patch) | |
tree | 7bb896bea45b7fd4a02eedc202eebc684db2e6ff | |
parent | d765b5b8c62bcf023dd8a4fcada3d377d52b450d (diff) | |
download | clang-534f692b4d1e6dd28dedebaee69a520fb1a73326.tar.gz clang-534f692b4d1e6dd28dedebaee69a520fb1a73326.tar.bz2 clang-534f692b4d1e6dd28dedebaee69a520fb1a73326.tar.xz |
Use std::error_code instead of llvm::error_code.
This is an update for a llvm api change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210688 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Basic/VirtualFileSystem.cpp | 24 | ||||
-rw-r--r-- | lib/Format/Format.cpp | 10 | ||||
-rw-r--r-- | lib/Frontend/CompilerInstance.cpp | 2 | ||||
-rw-r--r-- | unittests/Basic/VirtualFileSystemTest.cpp | 11 | ||||
-rw-r--r-- | unittests/Format/FormatTest.cpp | 12 |
5 files changed, 30 insertions, 29 deletions
diff --git a/lib/Basic/VirtualFileSystem.cpp b/lib/Basic/VirtualFileSystem.cpp index 3bca96449d..3515bf1c03 100644 --- a/lib/Basic/VirtualFileSystem.cpp +++ b/lib/Basic/VirtualFileSystem.cpp @@ -198,10 +198,10 @@ ErrorOr<Status> OverlayFileSystem::status(const Twine &Path) { // FIXME: handle symlinks that cross file systems for (iterator I = overlays_begin(), E = overlays_end(); I != E; ++I) { ErrorOr<Status> Status = (*I)->status(Path); - if (Status || Status.getError() != errc::no_such_file_or_directory) + if (Status || Status.getError() != std::errc::no_such_file_or_directory) return Status; } - return make_error_code(errc::no_such_file_or_directory); + return make_error_code(std::errc::no_such_file_or_directory); } error_code OverlayFileSystem::openFileForRead(const llvm::Twine &Path, @@ -209,10 +209,10 @@ error_code OverlayFileSystem::openFileForRead(const llvm::Twine &Path, // FIXME: handle symlinks that cross file systems for (iterator I = overlays_begin(), E = overlays_end(); I != E; ++I) { error_code EC = (*I)->openFileForRead(Path, Result); - if (!EC || EC != errc::no_such_file_or_directory) + if (!EC || EC != std::errc::no_such_file_or_directory) return EC; } - return make_error_code(errc::no_such_file_or_directory); + return make_error_code(std::errc::no_such_file_or_directory); } //===-----------------------------------------------------------------------===/ @@ -744,17 +744,17 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath(const Twine &Path_) { return EC; if (Path.empty()) - return make_error_code(errc::invalid_argument); + return make_error_code(std::errc::invalid_argument); sys::path::const_iterator Start = sys::path::begin(Path); sys::path::const_iterator End = sys::path::end(Path); for (std::vector<Entry *>::iterator I = Roots.begin(), E = Roots.end(); I != E; ++I) { ErrorOr<Entry *> Result = lookupPath(Start, End, *I); - if (Result || Result.getError() != errc::no_such_file_or_directory) + if (Result || Result.getError() != std::errc::no_such_file_or_directory) return Result; } - return make_error_code(errc::no_such_file_or_directory); + return make_error_code(std::errc::no_such_file_or_directory); } ErrorOr<Entry *> VFSFromYAML::lookupPath(sys::path::const_iterator Start, @@ -767,7 +767,7 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath(sys::path::const_iterator Start, if (CaseSensitive ? !Start->equals(From->getName()) : !Start->equals_lower(From->getName())) // failure to match - return make_error_code(errc::no_such_file_or_directory); + return make_error_code(std::errc::no_such_file_or_directory); ++Start; @@ -778,16 +778,16 @@ ErrorOr<Entry *> VFSFromYAML::lookupPath(sys::path::const_iterator Start, DirectoryEntry *DE = dyn_cast<DirectoryEntry>(From); if (!DE) - return make_error_code(errc::not_a_directory); + return make_error_code(std::errc::not_a_directory); for (DirectoryEntry::iterator I = DE->contents_begin(), E = DE->contents_end(); I != E; ++I) { ErrorOr<Entry *> Result = lookupPath(Start, End, *I); - if (Result || Result.getError() != errc::no_such_file_or_directory) + if (Result || Result.getError() != std::errc::no_such_file_or_directory) return Result; } - return make_error_code(errc::no_such_file_or_directory); + return make_error_code(std::errc::no_such_file_or_directory); } ErrorOr<Status> VFSFromYAML::status(const Twine &Path) { @@ -820,7 +820,7 @@ error_code VFSFromYAML::openFileForRead(const Twine &Path, FileEntry *F = dyn_cast<FileEntry>(*E); if (!F) // FIXME: errc::not_a_file? - return make_error_code(errc::invalid_argument); + return make_error_code(std::errc::invalid_argument); if (error_code EC = ExternalFS->openFileForRead(F->getExternalContentsPath(), Result)) diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp index f497126950..e3378d1446 100644 --- a/lib/Format/Format.cpp +++ b/lib/Format/Format.cpp @@ -447,7 +447,7 @@ llvm::error_code parseConfiguration(StringRef Text, FormatStyle *Style) { FormatStyle::LanguageKind Language = Style->Language; assert(Language != FormatStyle::LK_None); if (Text.trim().empty()) - return llvm::make_error_code(llvm::errc::invalid_argument); + return llvm::make_error_code(std::errc::invalid_argument); std::vector<FormatStyle> Styles; llvm::yaml::Input Input(Text); @@ -463,14 +463,14 @@ llvm::error_code parseConfiguration(StringRef Text, FormatStyle *Style) { for (unsigned i = 0; i < Styles.size(); ++i) { // Ensures that only the first configuration can skip the Language option. if (Styles[i].Language == FormatStyle::LK_None && i != 0) - return llvm::make_error_code(llvm::errc::invalid_argument); + return llvm::make_error_code(std::errc::invalid_argument); // Ensure that each language is configured at most once. for (unsigned j = 0; j < i; ++j) { if (Styles[i].Language == Styles[j].Language) { DEBUG(llvm::dbgs() << "Duplicate languages in the config file on positions " << j << " and " << i << "\n"); - return llvm::make_error_code(llvm::errc::invalid_argument); + return llvm::make_error_code(std::errc::invalid_argument); } } } @@ -485,7 +485,7 @@ llvm::error_code parseConfiguration(StringRef Text, FormatStyle *Style) { return llvm::error_code(); } } - return llvm::make_error_code(llvm::errc::not_supported); + return llvm::make_error_code(std::errc::not_supported); } std::string configurationAsText(const FormatStyle &Style) { @@ -2049,7 +2049,7 @@ FormatStyle getStyle(StringRef StyleName, StringRef FileName, break; } if (llvm::error_code ec = parseConfiguration(Text->getBuffer(), &Style)) { - if (ec == llvm::errc::not_supported) { + if (ec == std::errc::not_supported) { if (!UnsuitableConfigFiles.empty()) UnsuitableConfigFiles.append(", "); UnsuitableConfigFiles.append(ConfigFile); diff --git a/lib/Frontend/CompilerInstance.cpp b/lib/Frontend/CompilerInstance.cpp index f5e2749a71..bbcb71f3f1 100644 --- a/lib/Frontend/CompilerInstance.cpp +++ b/lib/Frontend/CompilerInstance.cpp @@ -572,7 +572,7 @@ CompilerInstance::createOutputFile(StringRef OutputPath, llvm::sys::fs::createUniqueFile(TempPath.str(), fd, TempPath); if (CreateMissingDirectories && - EC == llvm::errc::no_such_file_or_directory) { + EC == std::errc::no_such_file_or_directory) { StringRef Parent = llvm::sys::path::parent_path(OutputPath); EC = llvm::sys::fs::create_directories(Parent); if (!EC) { diff --git a/unittests/Basic/VirtualFileSystemTest.cpp b/unittests/Basic/VirtualFileSystemTest.cpp index 22e095a770..27d5e4cd05 100644 --- a/unittests/Basic/VirtualFileSystemTest.cpp +++ b/unittests/Basic/VirtualFileSystemTest.cpp @@ -35,7 +35,7 @@ public: std::map<std::string, vfs::Status>::iterator I = FilesAndDirs.find(Path.str()); if (I == FilesAndDirs.end()) - return make_error_code(errc::no_such_file_or_directory); + return make_error_code(std::errc::no_such_file_or_directory); return I->second; } error_code openFileForRead(const Twine &Path, @@ -306,7 +306,8 @@ TEST_F(VFSFromYAMLTest, MappedFiles) { EXPECT_TRUE(S->equivalent(*O->status("//root/"))); // non-volatile UniqueID // broken mapping - EXPECT_EQ(errc::no_such_file_or_directory, O->status("//root/file2").getError()); + EXPECT_EQ(std::errc::no_such_file_or_directory, + O->status("//root/file2").getError()); EXPECT_EQ(0, NumDiagnostics); } @@ -370,11 +371,11 @@ TEST_F(VFSFromYAMLTest, CaseSensitive) { O->pushOverlay(FS); ErrorOr<vfs::Status> SS = O->status("//root/xx"); - EXPECT_EQ(errc::no_such_file_or_directory, SS.getError()); + EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError()); SS = O->status("//root/xX"); - EXPECT_EQ(errc::no_such_file_or_directory, SS.getError()); + EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError()); SS = O->status("//root/Xx"); - EXPECT_EQ(errc::no_such_file_or_directory, SS.getError()); + EXPECT_EQ(std::errc::no_such_file_or_directory, SS.getError()); EXPECT_EQ(0, NumDiagnostics); } diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index f474c42144..f8bf85bdba 100644 --- a/unittests/Format/FormatTest.cpp +++ b/unittests/Format/FormatTest.cpp @@ -8181,7 +8181,7 @@ TEST_F(FormatTest, ParsesConfigurationWithLanguages) { CHECK_PARSE("Language: Cpp\n" "IndentWidth: 12", IndentWidth, 12u); - EXPECT_EQ(llvm::errc::not_supported, + EXPECT_EQ(std::errc::not_supported, parseConfiguration("Language: JavaScript\n" "IndentWidth: 34", &Style)); @@ -8194,9 +8194,9 @@ TEST_F(FormatTest, ParsesConfigurationWithLanguages) { "IndentWidth: 12", IndentWidth, 12u); CHECK_PARSE("IndentWidth: 23", IndentWidth, 23u); - EXPECT_EQ(llvm::errc::not_supported, parseConfiguration("Language: Cpp\n" - "IndentWidth: 34", - &Style)); + EXPECT_EQ(std::errc::not_supported, parseConfiguration("Language: Cpp\n" + "IndentWidth: 34", + &Style)); EXPECT_EQ(23u, Style.IndentWidth); CHECK_PARSE("IndentWidth: 56", IndentWidth, 56u); EXPECT_EQ(FormatStyle::LK_JavaScript, Style.Language); @@ -8254,7 +8254,7 @@ TEST_F(FormatTest, ParsesConfigurationWithLanguages) { EXPECT_EQ(789u, Style.TabWidth); - EXPECT_EQ(llvm::errc::invalid_argument, + EXPECT_EQ(std::errc::invalid_argument, parseConfiguration("---\n" "Language: JavaScript\n" "IndentWidth: 56\n" @@ -8262,7 +8262,7 @@ TEST_F(FormatTest, ParsesConfigurationWithLanguages) { "IndentWidth: 78\n" "...\n", &Style)); - EXPECT_EQ(llvm::errc::invalid_argument, + EXPECT_EQ(std::errc::invalid_argument, parseConfiguration("---\n" "Language: JavaScript\n" "IndentWidth: 56\n" |