Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang][AST] fix lack comparison of declRefExpr in ASTStructuralEquivalence #66047

Closed
mzyKi opened this issue Sep 12, 2023 · 1 comment · Fixed by #66041
Closed

[clang][AST] fix lack comparison of declRefExpr in ASTStructuralEquivalence #66047

mzyKi opened this issue Sep 12, 2023 · 1 comment · Fixed by #66041
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@mzyKi
Copy link
Contributor

mzyKi commented Sep 12, 2023

fixed in #66041

Before fix,the following testcase expected true. While I think only comparison of declName is not sufficient.Thanks for giving suggestions.

TEST_F(StructuralEquivalenceStmtTest, DeclRefENoEq) {
  std::string Prefix = "enum Test { AAA, BBB };";
  auto t = makeStmts(
      Prefix + "void foo(int i) {if (i > 0) {i = AAA;} else {i = BBB;}}",
      Prefix + "void foo(int i) {if (i > 0) {i = BBB;} else {i = AAA;}}",
      Lang_CXX03, ifStmt());
  EXPECT_FALSE(testStructuralMatch(t)); // EXPECT_TRUE
}
@github-actions github-actions bot added clang Clang issues not falling into any other category new issue labels Sep 12, 2023
@mzyKi mzyKi changed the title [clang] lack comparison of declRefExpr in ASTStructuralEquivalence [clang][AST] fix lack comparison of declRefExpr in ASTStructuralEquivalence Sep 15, 2023
@Endilll Endilll added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed clang Clang issues not falling into any other category new issue labels Sep 15, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 15, 2023

@llvm/issue-subscribers-clang-frontend

fixed in #66041

Before fix,the following testcase expected true. While I think only comparison of declName is not sufficient.Thanks for giving suggestions.

TEST_F(StructuralEquivalenceStmtTest, DeclRefENoEq) {
  std::string Prefix = "enum Test { AAA, BBB };";
  auto t = makeStmts(
      Prefix + "void foo(int i) {if (i > 0) {i = AAA;} else {i = BBB;}}",
      Prefix + "void foo(int i) {if (i > 0) {i = BBB;} else {i = AAA;}}",
      Lang_CXX03, ifStmt());
  EXPECT_FALSE(testStructuralMatch(t)); // EXPECT_TRUE
}

mzyKi added a commit that referenced this issue Sep 21, 2023
…alence (#66041)

Fixed #66047
Before fix,the following testcase expected true.
```cpp
TEST_F(StructuralEquivalenceStmtTest, DeclRefENoEq) {
  std::string Prefix = "enum Test { AAA, BBB };";
  auto t = makeStmts(
      Prefix + "void foo(int i) {if (i > 0) {i = AAA;} else {i = BBB;}}",
      Prefix + "void foo(int i) {if (i > 0) {i = BBB;} else {i = AAA;}}",
      Lang_CXX03, ifStmt());
  EXPECT_FALSE(testStructuralMatch(t)); // EXPECT_TRUE
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants