summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/ARCMigrate/FileRemapper.cpp2
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp2
-rw-r--r--clang/lib/Serialization/GlobalModuleIndex.cpp3
-rw-r--r--clang/unittests/Basic/VirtualFileSystemTest.cpp78
-rw-r--r--clang/unittests/Format/FormatTest.cpp27
5 files changed, 55 insertions, 57 deletions
diff --git a/clang/lib/ARCMigrate/FileRemapper.cpp b/clang/lib/ARCMigrate/FileRemapper.cpp
index e1cebc71a06..b84cbf02521 100644
--- a/clang/lib/ARCMigrate/FileRemapper.cpp
+++ b/clang/lib/ARCMigrate/FileRemapper.cpp
@@ -111,7 +111,7 @@ bool FileRemapper::initFromFile(StringRef filePath, DiagnosticsEngine &Diag,
bool FileRemapper::flushToDisk(StringRef outputDir, DiagnosticsEngine &Diag) {
using namespace llvm::sys;
- if (fs::create_directory(outputDir) != llvm::errc::success)
+ if (fs::create_directory(outputDir))
return report("Could not create directory: " + outputDir, Diag);
std::string infoFile = getRemapInfoFile(outputDir);
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 70c2fec6ce9..d8abd5307e0 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1971,7 +1971,7 @@ createVFSFromCompilerInvocation(const CompilerInvocation &CI,
// earlier vfs files are on the bottom
for (const std::string &File : CI.getHeaderSearchOpts().VFSOverlayFiles) {
std::unique_ptr<llvm::MemoryBuffer> Buffer;
- if (llvm::errc::success != llvm::MemoryBuffer::getFile(File, Buffer)) {
+ if (llvm::MemoryBuffer::getFile(File, Buffer)) {
Diags.Report(diag::err_missing_vfs_overlay_file) << File;
return IntrusiveRefCntPtr<vfs::FileSystem>();
}
diff --git a/clang/lib/Serialization/GlobalModuleIndex.cpp b/clang/lib/Serialization/GlobalModuleIndex.cpp
index 69c331b3ce0..851695173f2 100644
--- a/clang/lib/Serialization/GlobalModuleIndex.cpp
+++ b/clang/lib/Serialization/GlobalModuleIndex.cpp
@@ -240,8 +240,7 @@ GlobalModuleIndex::readIndex(StringRef Path) {
llvm::sys::path::append(IndexPath, IndexFileName);
std::unique_ptr<llvm::MemoryBuffer> Buffer;
- if (llvm::MemoryBuffer::getFile(IndexPath.c_str(), Buffer) !=
- llvm::errc::success)
+ if (llvm::MemoryBuffer::getFile(IndexPath.c_str(), Buffer))
return std::make_pair(nullptr, EC_NotFound);
/// \brief The bitstream reader from which we'll read the AST file.
diff --git a/clang/unittests/Basic/VirtualFileSystemTest.cpp b/clang/unittests/Basic/VirtualFileSystemTest.cpp
index 82b83875387..bcee16a8228 100644
--- a/clang/unittests/Basic/VirtualFileSystemTest.cpp
+++ b/clang/unittests/Basic/VirtualFileSystemTest.cpp
@@ -79,7 +79,7 @@ TEST(VirtualFileSystemTest, StatusQueries) {
D->addRegularFile("/foo");
Status = D->status("/foo");
- ASSERT_EQ(errc::success, Status.getError());
+ ASSERT_FALSE(Status.getError());
EXPECT_TRUE(Status->isStatusKnown());
EXPECT_FALSE(Status->isDirectory());
EXPECT_TRUE(Status->isRegularFile());
@@ -89,7 +89,7 @@ TEST(VirtualFileSystemTest, StatusQueries) {
D->addDirectory("/bar");
Status = D->status("/bar");
- ASSERT_EQ(errc::success, Status.getError());
+ ASSERT_FALSE(Status.getError());
EXPECT_TRUE(Status->isStatusKnown());
EXPECT_TRUE(Status->isDirectory());
EXPECT_FALSE(Status->isRegularFile());
@@ -99,7 +99,7 @@ TEST(VirtualFileSystemTest, StatusQueries) {
D->addSymlink("/baz");
Status = D->status("/baz");
- ASSERT_EQ(errc::success, Status.getError());
+ ASSERT_FALSE(Status.getError());
EXPECT_TRUE(Status->isStatusKnown());
EXPECT_FALSE(Status->isDirectory());
EXPECT_FALSE(Status->isRegularFile());
@@ -109,7 +109,7 @@ TEST(VirtualFileSystemTest, StatusQueries) {
EXPECT_TRUE(Status->equivalent(*Status));
ErrorOr<vfs::Status> Status2 = D->status("/foo");
- ASSERT_EQ(errc::success, Status2.getError());
+ ASSERT_FALSE(Status2.getError());
EXPECT_FALSE(Status->equivalent(*Status2));
}
@@ -123,11 +123,11 @@ TEST(VirtualFileSystemTest, BaseOnlyOverlay) {
D->addRegularFile("/foo");
Status = D->status("/foo");
- EXPECT_EQ(errc::success, Status.getError());
+ EXPECT_FALSE(Status.getError());
ErrorOr<vfs::Status> Status2((error_code()));
Status2 = O->status("/foo");
- EXPECT_EQ(errc::success, Status2.getError());
+ EXPECT_FALSE(Status2.getError());
EXPECT_TRUE(Status->equivalent(*Status2));
}
@@ -146,19 +146,19 @@ TEST(VirtualFileSystemTest, OverlayFiles) {
Base->addRegularFile("/foo");
StatusB = Base->status("/foo");
- ASSERT_EQ(errc::success, StatusB.getError());
+ ASSERT_FALSE(StatusB.getError());
Status1 = O->status("/foo");
- ASSERT_EQ(errc::success, Status1.getError());
+ ASSERT_FALSE(Status1.getError());
Middle->addRegularFile("/foo");
StatusM = Middle->status("/foo");
- ASSERT_EQ(errc::success, StatusM.getError());
+ ASSERT_FALSE(StatusM.getError());
Status2 = O->status("/foo");
- ASSERT_EQ(errc::success, Status2.getError());
+ ASSERT_FALSE(Status2.getError());
Top->addRegularFile("/foo");
StatusT = Top->status("/foo");
- ASSERT_EQ(errc::success, StatusT.getError());
+ ASSERT_FALSE(StatusT.getError());
Status3 = O->status("/foo");
- ASSERT_EQ(errc::success, Status3.getError());
+ ASSERT_FALSE(Status3.getError());
EXPECT_TRUE(Status1->equivalent(*StatusB));
EXPECT_TRUE(Status2->equivalent(*StatusM));
@@ -181,15 +181,15 @@ TEST(VirtualFileSystemTest, OverlayDirsNonMerged) {
// non-merged paths should be the same
ErrorOr<vfs::Status> Status1 = Lower->status("/lower-only");
- ASSERT_EQ(errc::success, Status1.getError());
+ ASSERT_FALSE(Status1.getError());
ErrorOr<vfs::Status> Status2 = O->status("/lower-only");
- ASSERT_EQ(errc::success, Status2.getError());
+ ASSERT_FALSE(Status2.getError());
EXPECT_TRUE(Status1->equivalent(*Status2));
Status1 = Upper->status("/upper-only");
- ASSERT_EQ(errc::success, Status1.getError());
+ ASSERT_FALSE(Status1.getError());
Status2 = O->status("/upper-only");
- ASSERT_EQ(errc::success, Status2.getError());
+ ASSERT_FALSE(Status2.getError());
EXPECT_TRUE(Status1->equivalent(*Status2));
}
@@ -205,17 +205,17 @@ TEST(VirtualFileSystemTest, MergedDirPermissions) {
Lower->addDirectory("/both", sys::fs::owner_read);
Upper->addDirectory("/both", sys::fs::owner_all | sys::fs::group_read);
Status = O->status("/both");
- ASSERT_EQ(errc::success, Status.getError());
+ ASSERT_FALSE(Status.getError());
EXPECT_EQ(0740, Status->getPermissions());
// permissions (as usual) are not recursively applied
Lower->addRegularFile("/both/foo", sys::fs::owner_read);
Upper->addRegularFile("/both/bar", sys::fs::owner_write);
Status = O->status("/both/foo");
- ASSERT_EQ(errc::success, Status.getError());
+ ASSERT_FALSE( Status.getError());
EXPECT_EQ(0400, Status->getPermissions());
Status = O->status("/both/bar");
- ASSERT_EQ(errc::success, Status.getError());
+ ASSERT_FALSE(Status.getError());
EXPECT_EQ(0200, Status->getPermissions());
}
@@ -292,7 +292,7 @@ TEST_F(VFSFromYAMLTest, MappedFiles) {
// file
ErrorOr<vfs::Status> S = O->status("//root/file1");
- ASSERT_EQ(errc::success, S.getError());
+ ASSERT_FALSE(S.getError());
EXPECT_EQ("//root/foo/bar/a", S->getName());
ErrorOr<vfs::Status> SLower = O->status("//root/foo/bar/a");
@@ -301,7 +301,7 @@ TEST_F(VFSFromYAMLTest, MappedFiles) {
// directory
S = O->status("//root/");
- ASSERT_EQ(errc::success, S.getError());
+ ASSERT_FALSE(S.getError());
EXPECT_TRUE(S->isDirectory());
EXPECT_TRUE(S->equivalent(*O->status("//root/"))); // non-volatile UniqueID
@@ -334,10 +334,10 @@ TEST_F(VFSFromYAMLTest, CaseInsensitive) {
O->pushOverlay(FS);
ErrorOr<vfs::Status> S = O->status("//root/XX");
- ASSERT_EQ(errc::success, S.getError());
+ ASSERT_FALSE(S.getError());
ErrorOr<vfs::Status> SS = O->status("//root/xx");
- ASSERT_EQ(errc::success, SS.getError());
+ ASSERT_FALSE(SS.getError());
EXPECT_TRUE(S->equivalent(*SS));
SS = O->status("//root/xX");
EXPECT_TRUE(S->equivalent(*SS));
@@ -531,10 +531,10 @@ TEST_F(VFSFromYAMLTest, MultiComponentPath) {
" 'external-contents': '//root/other' }]\n"
"}", Lower);
ASSERT_TRUE(NULL != FS.getPtr());
- EXPECT_EQ(errc::success, FS->status("//root/path/to/file").getError());
- EXPECT_EQ(errc::success, FS->status("//root/path/to").getError());
- EXPECT_EQ(errc::success, FS->status("//root/path").getError());
- EXPECT_EQ(errc::success, FS->status("//root/").getError());
+ EXPECT_FALSE(FS->status("//root/path/to/file").getError());
+ EXPECT_FALSE(FS->status("//root/path/to").getError());
+ EXPECT_FALSE(FS->status("//root/path").getError());
+ EXPECT_FALSE(FS->status("//root/").getError());
// at the start
FS = getFromYAMLString(
@@ -544,10 +544,10 @@ TEST_F(VFSFromYAMLTest, MultiComponentPath) {
" 'external-contents': '//root/other' }]}]\n"
"}", Lower);
ASSERT_TRUE(NULL != FS.getPtr());
- EXPECT_EQ(errc::success, FS->status("//root/path/to/file").getError());
- EXPECT_EQ(errc::success, FS->status("//root/path/to").getError());
- EXPECT_EQ(errc::success, FS->status("//root/path").getError());
- EXPECT_EQ(errc::success, FS->status("//root/").getError());
+ EXPECT_FALSE(FS->status("//root/path/to/file").getError());
+ EXPECT_FALSE(FS->status("//root/path/to").getError());
+ EXPECT_FALSE(FS->status("//root/path").getError());
+ EXPECT_FALSE(FS->status("//root/").getError());
// at the end
FS = getFromYAMLString(
@@ -557,10 +557,10 @@ TEST_F(VFSFromYAMLTest, MultiComponentPath) {
" 'external-contents': '//root/other' }]}]\n"
"}", Lower);
ASSERT_TRUE(NULL != FS.getPtr());
- EXPECT_EQ(errc::success, FS->status("//root/path/to/file").getError());
- EXPECT_EQ(errc::success, FS->status("//root/path/to").getError());
- EXPECT_EQ(errc::success, FS->status("//root/path").getError());
- EXPECT_EQ(errc::success, FS->status("//root/").getError());
+ EXPECT_FALSE(FS->status("//root/path/to/file").getError());
+ EXPECT_FALSE(FS->status("//root/path/to").getError());
+ EXPECT_FALSE(FS->status("//root/path").getError());
+ EXPECT_FALSE(FS->status("//root/").getError());
}
TEST_F(VFSFromYAMLTest, TrailingSlashes) {
@@ -575,8 +575,8 @@ TEST_F(VFSFromYAMLTest, TrailingSlashes) {
" 'external-contents': '//root/other' }]}]\n"
"}", Lower);
ASSERT_TRUE(NULL != FS.getPtr());
- EXPECT_EQ(errc::success, FS->status("//root/path/to/file").getError());
- EXPECT_EQ(errc::success, FS->status("//root/path/to").getError());
- EXPECT_EQ(errc::success, FS->status("//root/path").getError());
- EXPECT_EQ(errc::success, FS->status("//root/").getError());
+ EXPECT_FALSE(FS->status("//root/path/to/file").getError());
+ EXPECT_FALSE(FS->status("//root/path/to").getError());
+ EXPECT_FALSE(FS->status("//root/path").getError());
+ EXPECT_FALSE(FS->status("//root/").getError());
}
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 712af88329e..8aa256053fb 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -8187,20 +8187,19 @@ TEST_F(FormatTest, ParsesConfigurationWithLanguages) {
Style.IndentWidth = 234;
Style.BreakBeforeBraces = FormatStyle::BS_Linux;
Style.TabWidth = 345;
- EXPECT_EQ(llvm::errc::success,
- parseConfiguration("---\n"
- "IndentWidth: 456\n"
- "BreakBeforeBraces: Allman\n"
- "---\n"
- "Language: JavaScript\n"
- "IndentWidth: 111\n"
- "TabWidth: 111\n"
- "---\n"
- "Language: Cpp\n"
- "BreakBeforeBraces: Stroustrup\n"
- "TabWidth: 789\n"
- "...\n",
- &Style));
+ EXPECT_FALSE(parseConfiguration("---\n"
+ "IndentWidth: 456\n"
+ "BreakBeforeBraces: Allman\n"
+ "---\n"
+ "Language: JavaScript\n"
+ "IndentWidth: 111\n"
+ "TabWidth: 111\n"
+ "---\n"
+ "Language: Cpp\n"
+ "BreakBeforeBraces: Stroustrup\n"
+ "TabWidth: 789\n"
+ "...\n",
+ &Style));
EXPECT_EQ(123u, Style.ColumnLimit);
EXPECT_EQ(456u, Style.IndentWidth);
EXPECT_EQ(FormatStyle::BS_Stroustrup, Style.BreakBeforeBraces);
OpenPOWER on IntegriCloud