[llvm] 8e09f13 - [OrcJITTests] Fix warning: suggest explicit braces to avoid ambiguous 'else' (NFC)
Stefan Gränitz via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 23 02:50:18 PST 2024
Author: Stefan Gränitz
Date: 2024-01-23T11:49:41+01:00
New Revision: 8e09f13d679df6c34dd03d8ad6116c832318cab0
URL: https://github.com/llvm/llvm-project/commit/8e09f13d679df6c34dd03d8ad6116c832318cab0
DIFF: https://github.com/llvm/llvm-project/commit/8e09f13d679df6c34dd03d8ad6116c832318cab0.diff
LOG: [OrcJITTests] Fix warning: suggest explicit braces to avoid ambiguous 'else' (NFC)
Likely related to platform-specific expansion of gtest macros:
```
llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp:1276:12: warning: suggest explicit
braces to avoid ambiguous 'else' [-Wdangling-else]
```
Added:
Modified:
llvm/unittests/ExecutionEngine/JITLink/EHFrameSupportTests.cpp
llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/ExecutionEngine/JITLink/EHFrameSupportTests.cpp b/llvm/unittests/ExecutionEngine/JITLink/EHFrameSupportTests.cpp
index 3be932aa77cd6c..e7e09b3fe40b13 100644
--- a/llvm/unittests/ExecutionEngine/JITLink/EHFrameSupportTests.cpp
+++ b/llvm/unittests/ExecutionEngine/JITLink/EHFrameSupportTests.cpp
@@ -185,8 +185,9 @@ TEST(EHFrameCFIBlockInspector, BasicSuccessCase) {
if (CFIBI.isCIE()) {
CIEs.push_back(B);
// If this CIE has an edge, check that getPersonalityEdge returns it.
- if (B->edges_size() != 0)
+ if (B->edges_size() != 0) {
EXPECT_TRUE(!!CFIBI.getPersonalityEdge());
+ }
}
}
ASSERT_EQ(CIEs.size(), 2U);
diff --git a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
index a136e941fa9488..14934e000d2051 100644
--- a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
@@ -1193,8 +1193,9 @@ TEST_F(CoreAPIsStandardTest, SimpleAsynchronousGeneratorTest) {
[&](Expected<SymbolMap> Result) {
LookupCompleted = true;
EXPECT_THAT_EXPECTED(Result, Succeeded());
- if (Result)
+ if (Result) {
EXPECT_EQ(*Result, SymbolMap({{Foo, FooSym}}));
+ }
},
NoDependenciesToRegister);
@@ -1228,8 +1229,9 @@ TEST_F(CoreAPIsStandardTest, BlockedGeneratorAutoSuspensionTest) {
[&](Expected<SymbolMap> Result) {
Lookup1Completed = true;
EXPECT_THAT_EXPECTED(Result, Succeeded());
- if (Result)
+ if (Result) {
EXPECT_EQ(*Result, SymbolMap({{Foo, FooSym}}));
+ }
},
NoDependenciesToRegister);
@@ -1256,8 +1258,9 @@ TEST_F(CoreAPIsStandardTest, BlockedGeneratorAutoSuspensionTest) {
[&](Expected<SymbolMap> Result) {
Lookup2Completed = true;
EXPECT_THAT_EXPECTED(Result, Succeeded());
- if (Result)
+ if (Result) {
EXPECT_EQ(*Result, SymbolMap({{Bar, BarSym}}));
+ }
},
NoDependenciesToRegister);
@@ -1273,8 +1276,9 @@ TEST_F(CoreAPIsStandardTest, BlockedGeneratorAutoSuspensionTest) {
[&](Expected<SymbolMap> Result) {
Lookup3Completed = true;
EXPECT_THAT_EXPECTED(Result, Succeeded());
- if (Result)
+ if (Result) {
EXPECT_EQ(*Result, SymbolMap({{Bar, BarSym}}));
+ }
},
NoDependenciesToRegister);
@@ -1288,8 +1292,9 @@ TEST_F(CoreAPIsStandardTest, BlockedGeneratorAutoSuspensionTest) {
[&](Expected<SymbolMap> Result) {
Lookup4Completed = true;
EXPECT_THAT_EXPECTED(Result, Succeeded());
- if (Result)
+ if (Result) {
EXPECT_EQ(*Result, SymbolMap({{Baz, BazSym}}));
+ }
},
NoDependenciesToRegister);
@@ -1314,8 +1319,9 @@ TEST_F(CoreAPIsStandardTest, BlockedGeneratorAutoSuspensionTest) {
EXPECT_NE(G.Lookup, std::nullopt);
// Check that the most recently captured lookup is lookup 4 (for baz).
- if (G.Lookup)
+ if (G.Lookup) {
EXPECT_EQ(G.Lookup->Names.begin()->first, Baz);
+ }
cantFail(JD.define(absoluteSymbols({{Baz, BazSym}})));
G.takeLookup().LS.continueLookup(Error::success());
More information about the llvm-commits
mailing list