Author: gkistanova Date: Thu Jun 15 16:01:24 2017 New Revision: 305507 URL: http://llvm.org/viewvc/llvm-project?rev=305507&view=rev Log: Added braces to work around gcc warning in googletest: suggest explicit braces to avoid ambiguous 'else'. NFC.
Modified: cfe/trunk/unittests/AST/CommentLexer.cpp cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp cfe/trunk/unittests/Tooling/LookupTest.cpp Modified: cfe/trunk/unittests/AST/CommentLexer.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/CommentLexer.cpp?rev=305507&r1=305506&r2=305507&view=diff ============================================================================== --- cfe/trunk/unittests/AST/CommentLexer.cpp (original) +++ cfe/trunk/unittests/AST/CommentLexer.cpp Thu Jun 15 16:01:24 2017 @@ -320,9 +320,10 @@ TEST_F(CommentLexerTest, DoxygenCommand4 ASSERT_EQ(array_lengthof(Text), Toks.size()); for (size_t j = 0, e = Toks.size(); j != e; j++) { - if(Toks[j].is(tok::text)) + if(Toks[j].is(tok::text)) { ASSERT_EQ(StringRef(Text[j]), Toks[j].getText()) << "index " << i; + } } } } Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h?rev=305507&r1=305506&r2=305507&view=diff ============================================================================== --- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h (original) +++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.h Thu Jun 15 16:01:24 2017 @@ -320,10 +320,12 @@ public: ExpectedName(ExpectedName) {} void onEndOfTranslationUnit() override { - if (ExpectedCount != -1) + if (ExpectedCount != -1) { EXPECT_EQ(ExpectedCount, Count); - if (!ExpectedName.empty()) + } + if (!ExpectedName.empty()) { EXPECT_EQ(ExpectedName, Name); + } Count = 0; Name.clear(); } @@ -346,8 +348,9 @@ public: } BoundNodes::IDToNodeMap::const_iterator I = M.find(Id); EXPECT_NE(M.end(), I); - if (I != M.end()) + if (I != M.end()) { EXPECT_EQ(Nodes->getNodeAs<T>(Id), I->second.get<T>()); + } return true; } EXPECT_TRUE(M.count(Id) == 0 || Modified: cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp?rev=305507&r1=305506&r2=305507&view=diff ============================================================================== --- cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp (original) +++ cfe/trunk/unittests/Basic/VirtualFileSystemTest.cpp Thu Jun 15 16:01:24 2017 @@ -300,8 +300,9 @@ struct ScopedDir { EXPECT_FALSE(EC); } ~ScopedDir() { - if (Path != "") + if (Path != "") { EXPECT_FALSE(llvm::sys::fs::remove(Path.str())); + } } operator StringRef() { return Path.str(); } }; @@ -316,8 +317,9 @@ struct ScopedLink { EXPECT_FALSE(EC); } ~ScopedLink() { - if (Path != "") + if (Path != "") { EXPECT_FALSE(llvm::sys::fs::remove(Path.str())); + } } operator StringRef() { return Path.str(); } }; Modified: cfe/trunk/unittests/Tooling/LookupTest.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/LookupTest.cpp?rev=305507&r1=305506&r2=305507&view=diff ============================================================================== --- cfe/trunk/unittests/Tooling/LookupTest.cpp (original) +++ cfe/trunk/unittests/Tooling/LookupTest.cpp Thu Jun 15 16:01:24 2017 @@ -143,8 +143,9 @@ TEST(LookupTest, replaceNestedClassName) Visitor.OnRecordTypeLoc = [&](RecordTypeLoc Type) { // Filter Types by name since there are other `RecordTypeLoc` in the test // file. - if (Type.getDecl()->getQualifiedNameAsString() == "a::b::Foo") + if (Type.getDecl()->getQualifiedNameAsString() == "a::b::Foo") { EXPECT_EQ("x::Bar", replaceRecordTypeLoc(Type, "::a::x::Bar")); + } }; Visitor.runOver("namespace a { namespace b {\n" "class Foo;\n" @@ -155,8 +156,9 @@ TEST(LookupTest, replaceNestedClassName) // Filter Types by name since there are other `RecordTypeLoc` in the test // file. // `a::b::Foo` in using shadow decl is not `TypeLoc`. - if (Type.getDecl()->getQualifiedNameAsString() == "a::b::Foo") + if (Type.getDecl()->getQualifiedNameAsString() == "a::b::Foo") { EXPECT_EQ("Bar", replaceRecordTypeLoc(Type, "::a::x::Bar")); + } }; Visitor.runOver("namespace a { namespace b { class Foo {}; } }\n" "namespace c { using a::b::Foo; Foo f();; }\n"); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits