forked from OSchip/llvm-project
Use std::error_code instead of llvm::error_code.
This is an update for a llvm api change. llvm-svn: 210688
This commit is contained in:
parent
5c4f829424
commit
96b033006d
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue