]> granicus.if.org Git - clang/commitdiff
Added braces to work around gcc warning in googletest: suggest explicit braces to...
authorGalina Kistanova <gkistanova@gmail.com>
Thu, 15 Jun 2017 21:01:24 +0000 (21:01 +0000)
committerGalina Kistanova <gkistanova@gmail.com>
Thu, 15 Jun 2017 21:01:24 +0000 (21:01 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@305507 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/AST/CommentLexer.cpp
unittests/ASTMatchers/ASTMatchersTest.h
unittests/Basic/VirtualFileSystemTest.cpp
unittests/Tooling/LookupTest.cpp

index 77ee22ffb43e1108909cc13d33b6307df211a97e..f96d6cd15f7a92deb74203ad125704a11593698d 100644 (file)
@@ -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;
+      }
     }
   }
 }
index 4f5579ce0def17829ba0a58959990b131c09bec5..7cfe5b9e37097f6b73b79f5d0137fd2b32deb9d1 100644 (file)
@@ -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 ||
index 0856b17791fa99a78472ea9839484ffcf821de5d..40add2195b586a0749eaa7a87cd65ef3a3fa0208 100644 (file)
@@ -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(); }
 };
index cc3922d01b51c59306b5274a1a760a600d5dd089..f42f31e9dd99962e54558ca7de81f6ca7d5ad72c 100644 (file)
@@ -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");