[clang-format][NFC] Reformat the clang/unittests/Format directory
authorowenca <owenpiano@gmail.com>
Wed, 21 Sep 2022 20:17:28 +0000 (13:17 -0700)
committerowenca <owenpiano@gmail.com>
Wed, 21 Sep 2022 20:26:59 +0000 (13:26 -0700)
Also add a .clang-format file to clang/include/clang/Format and
clang/unittests/Format to keep the directories formatted.

clang/include/clang/Format/.clang-format [new file with mode: 0644]
clang/unittests/Format/.clang-format [new file with mode: 0644]
clang/unittests/Format/MacroCallReconstructorTest.cpp

diff --git a/clang/include/clang/Format/.clang-format b/clang/include/clang/Format/.clang-format
new file mode 100644 (file)
index 0000000..0e36277
--- /dev/null
@@ -0,0 +1,3 @@
+BasedOnStyle: LLVM
+InsertBraces: true
+RemoveBracesLLVM: true
diff --git a/clang/unittests/Format/.clang-format b/clang/unittests/Format/.clang-format
new file mode 100644 (file)
index 0000000..0e36277
--- /dev/null
@@ -0,0 +1,3 @@
+BasedOnStyle: LLVM
+InsertBraces: true
+RemoveBracesLLVM: true
index 3abe038..2b880d7 100644 (file)
@@ -52,9 +52,8 @@ public:
     Tokens.append(Expanded.begin(), Expanded.end());
 
     TokenList UnexpandedTokens;
-    for (const UnwrappedLineNode &Node : Unexpanded[ID]->Tokens) {
+    for (const UnwrappedLineNode &Node : Unexpanded[ID]->Tokens)
       UnexpandedTokens.push_back(Node.Tok);
-    }
     return UnexpandedTokens;
   }
 
@@ -71,9 +70,8 @@ private:
   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;
   }
   llvm::DenseMap<FormatToken *, std::unique_ptr<UnwrappedLine>> Unexpanded;
@@ -102,7 +100,7 @@ struct Matcher {
   Chunk consume(StringRef Tokens) {
     TokenList Result;
     for (const FormatToken *Token : uneof(Lex.lex(Tokens))) {
-      (void)Token;  // Fix unused variable warning when asserts are disabled.
+      (void)Token; // Fix unused variable warning when asserts are disabled.
       assert((*It)->getType() == Token->getType() &&
              (*It)->TokenText == Token->TokenText);
       Result.push_back(*It);
@@ -119,12 +117,10 @@ struct Matcher {
 UnexpandedMap mergeUnexpanded(const UnexpandedMap &M1,
                               const UnexpandedMap &M2) {
   UnexpandedMap Result;
-  for (const auto &KV : M1) {
+  for (const auto &KV : M1)
     Result[KV.first] = std::make_unique<UnwrappedLine>(*KV.second);
-  }
-  for (const auto &KV : M2) {
+  for (const auto &KV : M2)
     Result[KV.first] = std::make_unique<UnwrappedLine>(*KV.second);
-  }
   return Result;
 }
 
@@ -141,9 +137,8 @@ public:
 
   UnwrappedLine line(llvm::ArrayRef<FormatToken *> Tokens) {
     UnwrappedLine Result;
-    for (FormatToken *Tok : Tokens) {
+    for (FormatToken *Tok : Tokens)
       Result.Tokens.push_back(UnwrappedLineNode(Tok));
-    }
     return Result;
   }