Skip to content

Commit 314696a

Browse files
run clang format
1 parent 887e270 commit 314696a

File tree

1 file changed

+26
-31
lines changed

1 file changed

+26
-31
lines changed

llvm/unittests/IR/GlobalObjectTest.cpp

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,10 @@
1111
#include "llvm/AsmParser/Parser.h"
1212
#include "llvm/IR/Module.h"
1313
#include "llvm/Support/SourceMgr.h"
14-
#include "gtest/gtest.h"
1514
#include "gmock/gmock.h"
15+
#include "gtest/gtest.h"
1616
using namespace llvm;
1717
namespace {
18-
1918
using testing::Eq;
2019
using testing::Optional;
2120
using testing::StrEq;
@@ -33,49 +32,45 @@ static std::unique_ptr<Module> M;
3332

3433
class GlobalObjectTest : public testing::Test {
3534
public:
36-
static void SetUpTestSuite() {
37-
35+
static void SetUpTestSuite() {
3836
M = parseIR(C, R"(
3937
@foo = global i32 3, !section_prefix !0
4038
@bar = global i32 0
4139
4240
!0 = !{!"section_prefix", !"hot"}
4341
)");
44-
4542
}
46-
4743
};
4844

4945
TEST_F(GlobalObjectTest, SectionPrefix) {
50-
GlobalVariable* Foo = M->getGlobalVariable("foo");
51-
52-
// Initial section prefix is hot.
53-
ASSERT_NE(Foo, nullptr);
54-
ASSERT_THAT(Foo->getSectionPrefix(), Optional(StrEq("hot")));
46+
GlobalVariable *Foo = M->getGlobalVariable("foo");
5547

56-
// No actual update.
57-
EXPECT_FALSE(Foo->updateSectionPrefix("hot"));
48+
// Initial section prefix is hot.
49+
ASSERT_NE(Foo, nullptr);
50+
ASSERT_THAT(Foo->getSectionPrefix(), Optional(StrEq("hot")));
5851

59-
// Update prefix from hot to unlikely.
60-
Foo->setSectionPrefix("unlikely");
61-
EXPECT_THAT(Foo->getSectionPrefix(), Optional(StrEq("unlikely")));
62-
63-
// Update prefix to empty is the same as clear.
64-
Foo->setSectionPrefix("");
65-
EXPECT_THAT(Foo->getSectionPrefix(), Eq(std::nullopt));
52+
// No actual update.
53+
EXPECT_FALSE(Foo->updateSectionPrefix("hot"));
6654

67-
GlobalVariable* Bar = M->getGlobalVariable("bar");
55+
// Update prefix from hot to unlikely.
56+
Foo->setSectionPrefix("unlikely");
57+
EXPECT_THAT(Foo->getSectionPrefix(), Optional(StrEq("unlikely")));
6858

69-
// Initial section prefix is empty.
70-
ASSERT_NE(Bar, nullptr);
71-
ASSERT_THAT(Bar->getSectionPrefix(), Eq(std::nullopt));
72-
73-
// No actual update.
74-
EXPECT_FALSE(Bar->updateSectionPrefix(""));
59+
// Update prefix to empty is the same as clear.
60+
Foo->setSectionPrefix("");
61+
EXPECT_THAT(Foo->getSectionPrefix(), Eq(std::nullopt));
7562

76-
// Update from empty to hot.
77-
EXPECT_TRUE(Bar->updateSectionPrefix("hot"));
78-
EXPECT_THAT(Bar->getSectionPrefix(), Optional(StrEq("hot")));
79-
}
63+
GlobalVariable *Bar = M->getGlobalVariable("bar");
64+
65+
// Initial section prefix is empty.
66+
ASSERT_NE(Bar, nullptr);
67+
ASSERT_THAT(Bar->getSectionPrefix(), Eq(std::nullopt));
8068

69+
// No actual update.
70+
EXPECT_FALSE(Bar->updateSectionPrefix(""));
71+
72+
// Update from empty to hot.
73+
EXPECT_TRUE(Bar->updateSectionPrefix("hot"));
74+
EXPECT_THAT(Bar->getSectionPrefix(), Optional(StrEq("hot")));
75+
}
8176
} // namespace

0 commit comments

Comments
 (0)