[llvm] r275291 - Fix warnings in FunctionTest.cpp.
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 13 11:17:48 PDT 2016
Author: jlebar
Date: Wed Jul 13 13:17:46 2016
New Revision: 275291
URL: http://llvm.org/viewvc/llvm-project?rev=275291&view=rev
Log:
Fix warnings in FunctionTest.cpp.
Because of the goop involved in the EXPECT_EQ macro, we were getting the
following warning
expression with side effects has no effect in an unevaluated context
because the "I++" was being used inside of a template type:
switch (0) case 0: default: if (const ::testing::AssertionResult gtest_ar = (::testing::internal:: EqHelper<(sizeof(::testing::internal::IsNullLiteralHelper(Args[I++])) == 1)>::Compare("Args[I++]", "&A", Args[I++], &A))) ; else ::testing::internal::AssertHelper(::testing::TestPartResult::kNonFatalFailure, "../src/unittests/IR/FunctionTest.cpp", 94, gtest_ar.failure_message()) = ::testing::Message();
Modified:
llvm/trunk/unittests/IR/FunctionTest.cpp
Modified: llvm/trunk/unittests/IR/FunctionTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/FunctionTest.cpp?rev=275291&r1=275290&r2=275291&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/FunctionTest.cpp (original)
+++ llvm/trunk/unittests/IR/FunctionTest.cpp Wed Jul 13 13:17:46 2016
@@ -70,15 +70,19 @@ TEST(FunctionTest, stealArgumentListFrom
EXPECT_TRUE(F1->hasLazyArguments());
EXPECT_FALSE(F2->hasLazyArguments());
unsigned I = 0;
- for (Argument &A : F2->args())
- EXPECT_EQ(Args[I++], &A);
+ for (Argument &A : F2->args()) {
+ EXPECT_EQ(Args[I], &A);
+ I++;
+ }
EXPECT_EQ(2u, I);
// Check that arguments in F1 don't have pointer equality with the saved ones.
// This also instantiates F1's arguments.
I = 0;
- for (Argument &A : F1->args())
- EXPECT_NE(Args[I++], &A);
+ for (Argument &A : F1->args()) {
+ EXPECT_NE(Args[I], &A);
+ I++;
+ }
EXPECT_EQ(2u, I);
EXPECT_FALSE(F1->hasLazyArguments());
EXPECT_FALSE(F2->hasLazyArguments());
@@ -90,8 +94,10 @@ TEST(FunctionTest, stealArgumentListFrom
EXPECT_FALSE(F1->hasLazyArguments());
EXPECT_TRUE(F2->hasLazyArguments());
I = 0;
- for (Argument &A : F1->args())
- EXPECT_EQ(Args[I++], &A);
+ for (Argument &A : F1->args()) {
+ EXPECT_EQ(Args[I], &A);
+ I++;
+ }
EXPECT_EQ(2u, I);
// Steal from F2 a second time. Now both functions should have lazy
More information about the llvm-commits
mailing list