[clang] [ASTMatchers] Fix classIsDerivedFrom for recusrive cases (PR #67307)
Caslyn Tonelli via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 25 11:17:52 PDT 2023
Caslyn wrote:
Hi @ilya-biryukov - it seems this PR caused a couple test failures in RecursiveASTVisitorTests/ on the Fuchsia windows-x64 builder.
Could you take a look to verify whether an additional fix (or revert) is needed?
[clang-windows-x64-test failures](https://luci-milo.appspot.com/ui/p/fuchsia/builders/prod/clang-windows-x64/b8768972500924760625/test-results?sortby=&groupby=)
```
Script:
--
C:\b\s\w\ir\x\w\llvm_build\tools\clang\stage2-bins\tools\clang\unittests\Tooling\.\ToolingTests.exe --gtest_filter=RecursiveASTVisitor.StmtCallbacks_TraverseBinaryOperator
--
C:/b/s/w/ir/x/w/llvm-llvm-project/clang/unittests/Tooling/RecursiveASTVisitorTests\CallbacksCommon.h:94
Expected equality of these values:
ExpectedLog.trim().str()
Which is: "WalkUpFromStmt CompoundStmt\nWalkUpFromStmt IntegerLiteral(1)\nTraverseBinaryOperator BinaryOperator(+)\n WalkUpFromStmt BinaryOperator(+)\n WalkUpFromStmt IntegerLiteral(2)\n WalkUpFromStmt IntegerLiteral(3)\nWalkUpFromStmt IntegerLiteral(4)"
StringRef(Visitor.CallbackLog).trim().str()
Which is: "RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt CompoundStmt\nRecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(1)\nRecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::TraverseBinaryOperator BinaryOperator(+)\n RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt BinaryOperator(+)\n RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(2)\n RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(3)\nRecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(4)"
With diff:
@@ -1,7 +1,7 @@
-WalkUpFromStmt CompoundStmt
-WalkUpFromStmt IntegerLiteral(1)
-TraverseBinaryOperator BinaryOperator(+)
- WalkUpFromStmt BinaryOperator(+)
- WalkUpFromStmt IntegerLiteral(2)
- WalkUpFromStmt IntegerLiteral(3)
-WalkUpFromStmt IntegerLiteral(4)
+RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt CompoundStmt
+RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(1)
+RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::TraverseBinaryOperator BinaryOperator(+)
+ RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt BinaryOperator(+)
+ RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(2)
+ RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(3)
+RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(4)
C:/b/s/w/ir/x/w/llvm-llvm-project/clang/unittests/Tooling/RecursiveASTVisitorTests/CallbacksBinaryOperator.cpp:49
Value of: visitorCallbackLogEqual( RecordingVisitor(ShouldTraversePostOrder::No), Code, R"txt(
WalkUpFromStmt CompoundStmt
WalkUpFromStmt IntegerLiteral(1)
TraverseBinaryOperator BinaryOperator(+)
WalkUpFromStmt BinaryOperator(+)
WalkUpFromStmt IntegerLiteral(2)
WalkUpFromStmt IntegerLiteral(3)
WalkUpFromStmt IntegerLiteral(4)
)txt")
Actual: false
Expected: true
C:/b/s/w/ir/x/w/llvm-llvm-project/clang/unittests/Tooling/RecursiveASTVisitorTests\CallbacksCommon.h:94
Expected equality of these values:
ExpectedLog.trim().str()
Which is: "WalkUpFromStmt IntegerLiteral(1)\nTraverseBinaryOperator BinaryOperator(+)\n WalkUpFromStmt IntegerLiteral(2)\n WalkUpFromStmt IntegerLiteral(3)\n WalkUpFromStmt BinaryOperator(+)\nWalkUpFromStmt IntegerLiteral(4)\nWalkUpFromStmt CompoundStmt"
StringRef(Visitor.CallbackLog).trim().str()
Which is: "RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(1)\nRecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::TraverseBinaryOperator BinaryOperator(+)\n RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(2)\n RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(3)\n RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt BinaryOperator(+)\nRecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(4)\nRecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt CompoundStmt"
With diff:
@@ -1,7 +1,7 @@
-WalkUpFromStmt IntegerLiteral(1)
-TraverseBinaryOperator BinaryOperator(+)
- WalkUpFromStmt IntegerLiteral(2)
- WalkUpFromStmt IntegerLiteral(3)
- WalkUpFromStmt BinaryOperator(+)
-WalkUpFromStmt IntegerLiteral(4)
-WalkUpFromStmt CompoundStmt
+RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(1)
+RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::TraverseBinaryOperator BinaryOperator(+)
+ RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(2)
+ RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(3)
+ RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt BinaryOperator(+)
+RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt IntegerLiteral(4)
+RecursiveASTVisitor_StmtCallbacks_TraverseBinaryOperator_Test::TestBody()::RecordingVisitor::WalkUpFromStmt CompoundStmt
C:/b/s/w/ir/x/w/llvm-llvm-project/clang/unittests/Tooling/RecursiveASTVisitorTests/CallbacksBinaryOperator.cpp:61
Value of: visitorCallbackLogEqual( RecordingVisitor(ShouldTraversePostOrder::Yes), Code, R"txt(
WalkUpFromStmt IntegerLiteral(1)
TraverseBinaryOperator BinaryOperator(+)
WalkUpFromStmt IntegerLiteral(2)
WalkUpFromStmt IntegerLiteral(3)
WalkUpFromStmt BinaryOperator(+)
WalkUpFromStmt IntegerLiteral(4)
WalkUpFromStmt CompoundStmt
)txt")
Actual: false
Expected: true
```
https://github.com/llvm/llvm-project/pull/67307
More information about the cfe-commits
mailing list