[clang] [RecursiveASTVisitor] Fix RecursiveASTVisitor (RAV) fails to visit the initializer of a bitfield (PR #69557)

via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 18 20:52:10 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff b858309ddc977d5e70de54f3fa3888915b5fbc0c 96f6b90ed4a70430f94eab2d9ca317dd8367022a -- clang/unittests/Tooling/RecursiveASTVisitorTests/BitfieldInitializer.cpp clang/include/clang/AST/RecursiveASTVisitor.h
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/unittests/Tooling/RecursiveASTVisitorTests/BitfieldInitializer.cpp b/clang/unittests/Tooling/RecursiveASTVisitorTests/BitfieldInitializer.cpp
index 676a491a4304..c11e726fe855 100644
--- a/clang/unittests/Tooling/RecursiveASTVisitorTests/BitfieldInitializer.cpp
+++ b/clang/unittests/Tooling/RecursiveASTVisitorTests/BitfieldInitializer.cpp
@@ -14,7 +14,8 @@ using namespace clang;
 namespace {
 
 // Check to ensure that bitfield initializers are visited.
-class BitfieldInitializerVisitor : public ExpectedLocationVisitor<BitfieldInitializerVisitor> {
+class BitfieldInitializerVisitor
+    : public ExpectedLocationVisitor<BitfieldInitializerVisitor> {
 public:
   bool VisitIntegerLiteral(IntegerLiteral *IL) {
     Match(std::to_string(IL->getValue().getSExtValue()), IL->getLocation());
@@ -24,11 +25,10 @@ public:
 
 TEST(RecursiveASTVisitor, BitfieldInitializerIsVisited) {
   BitfieldInitializerVisitor Visitor;
-  Visitor.ExpectMatch("123", 2, 15); 
-  EXPECT_TRUE(Visitor.runOver(
-    "struct S {\n"
-    "  int x : 8 = 123;\n"
-    "};\n"));
+  Visitor.ExpectMatch("123", 2, 15);
+  EXPECT_TRUE(Visitor.runOver("struct S {\n"
+                              "  int x : 8 = 123;\n"
+                              "};\n"));
 }
 
 } // end anonymous namespace

``````````

</details>


https://github.com/llvm/llvm-project/pull/69557


More information about the cfe-commits mailing list