Added braces to work around gcc warning in googletest: suggest explicit braces to avoid ambiguous 'else'. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305506 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Galina Kistanova 2017-06-15 21:00:40 +00:00
parent 48370ee21f
commit 7438bc918d
5 changed files with 22 additions and 11 deletions

View File

@ -63,8 +63,9 @@ TEST(SCCIteratorTest, AllSmallGraphs) {
// Check that every node in the SCC is reachable from every other node in
// the SCC.
for (unsigned i = 0; i != NUM_NODES; ++i)
if (NodesInThisSCC.count(i))
if (NodesInThisSCC.count(i)) {
EXPECT_TRUE(NodesInThisSCC.isSubsetOf(G.NodesReachableFrom(i)));
}
// OK, now that we now that every node in the SCC is reachable from every
// other, this means that the set of nodes reachable from any node in the
@ -78,8 +79,9 @@ TEST(SCCIteratorTest, AllSmallGraphs) {
NodesReachableFromSCC.Meet(NodesInThisSCC.Complement());
for (unsigned j = 0; j != NUM_NODES; ++j)
if (ReachableButNotInSCC.count(j))
if (ReachableButNotInSCC.count(j)) {
EXPECT_TRUE(G.NodesReachableFrom(j).Meet(NodesInThisSCC).isEmpty());
}
// The result must be the same for all other nodes in this SCC, so
// there is no point in checking them.

View File

@ -882,8 +882,9 @@ TEST(StringRefTest, getAsDouble) {
double Result;
StringRef S(Entry.Str);
EXPECT_EQ(Entry.ShouldFail, S.getAsDouble(Result, Entry.AllowInexact));
if (!Entry.ShouldFail)
if (!Entry.ShouldFail) {
EXPECT_EQ(Result, Entry.D);
}
}
}

View File

@ -137,8 +137,9 @@ TEST(LowLevelTypeTest, Vector) {
if ((Elts % 2) == 0) {
EXPECT_EQ(S * (Elts / 2), HalfEltIfEvenTy.getSizeInBits());
EXPECT_EQ(S, HalfEltIfEvenTy.getScalarSizeInBits());
if (Elts > 2)
if (Elts > 2) {
EXPECT_EQ(Elts / 2, HalfEltIfEvenTy.getNumElements());
}
}
EXPECT_EQ(S * (Elts * 2), DoubleEltTy.getSizeInBits());

View File

@ -311,8 +311,9 @@ void TestAllForms() {
EXPECT_EQ(Data2, toReference(DieDG.find(Attr_DW_FORM_ref2), 0));
EXPECT_EQ(Data4, toReference(DieDG.find(Attr_DW_FORM_ref4), 0));
EXPECT_EQ(Data8, toReference(DieDG.find(Attr_DW_FORM_ref8), 0));
if (Version >= 4)
if (Version >= 4) {
EXPECT_EQ(Data8_2, toReference(DieDG.find(Attr_DW_FORM_ref_sig8), 0));
}
EXPECT_EQ(UData[0], toReference(DieDG.find(Attr_DW_FORM_ref_udata), 0));
//----------------------------------------------------------------------
@ -320,15 +321,17 @@ void TestAllForms() {
//----------------------------------------------------------------------
EXPECT_EQ(1ULL, toUnsigned(DieDG.find(Attr_DW_FORM_flag_true), 0));
EXPECT_EQ(0ULL, toUnsigned(DieDG.find(Attr_DW_FORM_flag_false), 1));
if (Version >= 4)
if (Version >= 4) {
EXPECT_EQ(1ULL, toUnsigned(DieDG.find(Attr_DW_FORM_flag_present), 0));
}
//----------------------------------------------------------------------
// Test SLEB128 based forms
//----------------------------------------------------------------------
EXPECT_EQ(SData, toSigned(DieDG.find(Attr_DW_FORM_sdata), 0));
if (Version >= 5)
if (Version >= 5) {
EXPECT_EQ(ICSData, toSigned(DieDG.find(Attr_DW_FORM_implicit_const), 0));
}
//----------------------------------------------------------------------
// Test ULEB128 based forms
@ -340,9 +343,10 @@ void TestAllForms() {
//----------------------------------------------------------------------
EXPECT_EQ(Dwarf32Values[0],
toReference(DieDG.find(Attr_DW_FORM_GNU_ref_alt), 0));
if (Version >= 4)
if (Version >= 4) {
EXPECT_EQ(Dwarf32Values[1],
toSectionOffset(DieDG.find(Attr_DW_FORM_sec_offset), 0));
}
//----------------------------------------------------------------------
// Add an address at the end to make sure we can decode this value

View File

@ -180,8 +180,9 @@ void testCommandLineTokenizer(ParserFunction *parse, StringRef Input,
parse(Input, Saver, Actual, /*MarkEOLs=*/false);
EXPECT_EQ(OutputSize, Actual.size());
for (unsigned I = 0, E = Actual.size(); I != E; ++I) {
if (I < OutputSize)
if (I < OutputSize) {
EXPECT_STREQ(Output[I], Actual[I]);
}
}
}
@ -528,8 +529,9 @@ TEST(CommandLineTest, GetRegisteredSubcommands) {
EXPECT_FALSE(Opt1);
EXPECT_FALSE(Opt2);
for (auto *S : cl::getRegisteredSubcommands()) {
if (*S)
if (*S) {
EXPECT_EQ("sc1", S->getName());
}
}
cl::ResetAllOptionOccurrences();
@ -538,8 +540,9 @@ TEST(CommandLineTest, GetRegisteredSubcommands) {
EXPECT_FALSE(Opt1);
EXPECT_FALSE(Opt2);
for (auto *S : cl::getRegisteredSubcommands()) {
if (*S)
if (*S) {
EXPECT_EQ("sc2", S->getName());
}
}
}