[clang] 34ce42f - [clang-format] Reformat. NFC.
Marek Kurdej via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 17 01:27:49 PDT 2022
Author: Marek Kurdej
Date: 2022-03-17T09:27:31+01:00
New Revision: 34ce42fe4de5318176e13e4cb758dfa7a0d8176b
URL: https://github.com/llvm/llvm-project/commit/34ce42fe4de5318176e13e4cb758dfa7a0d8176b
DIFF: https://github.com/llvm/llvm-project/commit/34ce42fe4de5318176e13e4cb758dfa7a0d8176b.diff
LOG: [clang-format] Reformat. NFC.
Added:
Modified:
clang/lib/Format/WhitespaceManager.cpp
clang/unittests/Format/FormatTest.cpp
clang/unittests/Format/FormatTestJson.cpp
clang/unittests/Format/MacroExpanderTest.cpp
clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
clang/unittests/Format/TestLexer.h
Removed:
################################################################################
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index de6cdf4afd729..2dcc4fd62c5e8 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -1163,9 +1163,8 @@ void WhitespaceManager::alignArrayInitializersLeftJustified(
auto Offset = std::distance(Cells.begin(), CellIter);
for (const auto *Next = CellIter->NextColumnElement; Next != nullptr;
Next = Next->NextColumnElement) {
- if (RowCount > CellDescs.CellCounts.size()) {
+ if (RowCount > CellDescs.CellCounts.size())
break;
- }
auto *Start = (Cells.begin() + RowCount * CellDescs.CellCounts[0]);
auto *End = Start + Offset;
auto ThisNetWidth = getNetWidth(Start, End, CellDescs.InitialSpaces);
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 8ee6040cd0f69..469252a252887 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -7217,9 +7217,8 @@ TEST_F(FormatTest, MemoizationTests) {
OnePerLine.BinPackParameters = false;
std::string input = "Constructor()\n"
" : aaaa(a,\n";
- for (unsigned i = 0, e = 80; i != e; ++i) {
+ for (unsigned i = 0, e = 80; i != e; ++i)
input += " a,\n";
- }
input += " a) {}";
verifyFormat(input, OnePerLine);
}
diff --git a/clang/unittests/Format/FormatTestJson.cpp b/clang/unittests/Format/FormatTestJson.cpp
index 14a48182f9dfe..e213f6bcbe712 100644
--- a/clang/unittests/Format/FormatTestJson.cpp
+++ b/clang/unittests/Format/FormatTestJson.cpp
@@ -30,14 +30,12 @@ class FormatTestJson : public ::testing::Test {
if (Style.isJson() && !Style.DisableFormat) {
auto Err = Replaces.add(
tooling::Replacement(tooling::Replacement("", 0, 0, "x = ")));
- if (Err) {
+ if (Err)
llvm::errs() << "Bad Json variable insertion\n";
- }
}
auto ChangedCode = applyAllReplacements(Code, Replaces);
- if (!ChangedCode) {
+ if (!ChangedCode)
llvm::errs() << "Bad Json varibale replacement\n";
- }
StringRef NewCode = *ChangedCode;
std::vector<tooling::Range> Ranges(1, tooling::Range(0, NewCode.size()));
diff --git a/clang/unittests/Format/MacroExpanderTest.cpp b/clang/unittests/Format/MacroExpanderTest.cpp
index 7ec98a5e82b7b..37fa8d1cfc179 100644
--- a/clang/unittests/Format/MacroExpanderTest.cpp
+++ b/clang/unittests/Format/MacroExpanderTest.cpp
@@ -28,9 +28,8 @@ class MacroExpanderTest : public ::testing::Test {
llvm::SmallVector<TokenList, 1>
lexArgs(const std::vector<std::string> &Args) {
llvm::SmallVector<TokenList, 1> Result;
- for (const auto &Arg : Args) {
+ for (const auto &Arg : Args)
Result.push_back(uneof(Lex.lex(Arg)));
- }
return Result;
}
@@ -78,9 +77,8 @@ class MacroExpanderTest : public ::testing::Test {
TEST_F(MacroExpanderTest, SkipsDefinitionOnError) {
auto Macros =
create({"A(", "B(,", "C(a,", "D(a a", "E(a, a", "F(,)", "G(a;"});
- for (const auto *Name : {"A", "B", "C", "D", "E", "F", "G"}) {
+ for (const auto *Name : {"A", "B", "C", "D", "E", "F", "G"})
EXPECT_FALSE(Macros->defined(Name)) << "for Name " << Name;
- }
}
TEST_F(MacroExpanderTest, ExpandsWithoutArguments) {
diff --git a/clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp b/clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
index 50b861fea1daf..342fdd3418098 100644
--- a/clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
+++ b/clang/unittests/Format/NamespaceEndCommentsFixerTest.cpp
@@ -469,7 +469,8 @@ TEST_F(NamespaceEndCommentsFixerTest, WorksForObjCpp) {
fixNamespaceEndComments("namespace {\n"
"int i;\n"
"int j;\n"
- "}", ObjCppStyle));
+ "}",
+ ObjCppStyle));
}
TEST_F(NamespaceEndCommentsFixerTest, AddsMacroEndComment) {
diff --git a/clang/unittests/Format/TestLexer.h b/clang/unittests/Format/TestLexer.h
index ae9818d7561b8..a1585fc5cac6d 100644
--- a/clang/unittests/Format/TestLexer.h
+++ b/clang/unittests/Format/TestLexer.h
@@ -37,9 +37,8 @@ inline std::ostream &operator<<(std::ostream &Stream, const FormatToken &Tok) {
}
inline std::ostream &operator<<(std::ostream &Stream, const TokenList &Tokens) {
Stream << "{";
- for (size_t I = 0, E = Tokens.size(); I != E; ++I) {
+ for (size_t I = 0, E = Tokens.size(); I != E; ++I)
Stream << (I > 0 ? ", " : "") << *Tokens[I];
- }
Stream << "} (" << Tokens.size() << " tokens)";
return Stream;
}
More information about the cfe-commits
mailing list