Author: owenca Date: 2022-09-21T13:26:59-07:00 New Revision: e347c0fc9bf8a9c415ca09887bf707e718b8fb1c
URL: https://github.com/llvm/llvm-project/commit/e347c0fc9bf8a9c415ca09887bf707e718b8fb1c DIFF: https://github.com/llvm/llvm-project/commit/e347c0fc9bf8a9c415ca09887bf707e718b8fb1c.diff LOG: [clang-format][NFC] Reformat the clang/unittests/Format directory Also add a .clang-format file to clang/include/clang/Format and clang/unittests/Format to keep the directories formatted. Added: clang/include/clang/Format/.clang-format clang/unittests/Format/.clang-format Modified: clang/unittests/Format/MacroCallReconstructorTest.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Format/.clang-format b/clang/include/clang/Format/.clang-format new file mode 100644 index 0000000000000..0e362770f3537 --- /dev/null +++ b/clang/include/clang/Format/.clang-format @@ -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 index 0000000000000..0e362770f3537 --- /dev/null +++ b/clang/unittests/Format/.clang-format @@ -0,0 +1,3 @@ +BasedOnStyle: LLVM +InsertBraces: true +RemoveBracesLLVM: true diff --git a/clang/unittests/Format/MacroCallReconstructorTest.cpp b/clang/unittests/Format/MacroCallReconstructorTest.cpp index 3abe0383aeae6..2b880d75b514f 100644 --- a/clang/unittests/Format/MacroCallReconstructorTest.cpp +++ b/clang/unittests/Format/MacroCallReconstructorTest.cpp @@ -52,9 +52,8 @@ class Expansion { 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 @@ class Expansion { 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 @@ class MacroCallReconstructorTest : public ::testing::Test { UnwrappedLine line(llvm::ArrayRef<FormatToken *> Tokens) { UnwrappedLine Result; - for (FormatToken *Tok : Tokens) { + for (FormatToken *Tok : Tokens) Result.Tokens.push_back(UnwrappedLineNode(Tok)); - } return Result; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits