History log of /llvm-project/clang/unittests/AST/StructuralEquivalenceTest.cpp (Results 1 – 25 of 52)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5, llvmorg-19.1.4
# 7a1fdbb9 13-Nov-2024 Balázs Kéri <balazs.keri@ericsson.com>

[clang][AST] Add 'IgnoreTemplateParmDepth' to structural equivalence cache (#115518)

Structural equivalence check uses a cache to store already found
non-equivalent values. This cache can be reused

[clang][AST] Add 'IgnoreTemplateParmDepth' to structural equivalence cache (#115518)

Structural equivalence check uses a cache to store already found
non-equivalent values. This cache can be reused for calls (ASTImporter
does this). Value of "IgnoreTemplateParmDepth" can have an effect on the
structural equivalence therefore it is wrong to reuse the same cache for
checks with different values of 'IgnoreTemplateParmDepth'. The current
change adds the 'IgnoreTemplateParmDepth' to the cache key to fix the
problem.

show more ...


Revision tags: llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1
# 978c40b4 26-Jul-2024 Ding Fei <fding@feysh.com>

[clang][ASTImporter][NFC] add unittests for unnamed EnumDecl (#100545)

These tests are for multiple anonymous EnumDecls structural eq test &
importing.

We found the anonymous enums importing iss

[clang][ASTImporter][NFC] add unittests for unnamed EnumDecl (#100545)

These tests are for multiple anonymous EnumDecls structural eq test &
importing.

We found the anonymous enums importing issue a few days ago and tried to
fix it
but 0a6233a68c7b575d05bca0f0c708b7e97cc710d1 already did this. I think
these tests are still useful for regressions.

show more ...


Revision tags: llvmorg-20-init, llvmorg-18.1.8
# 66a9e264 12-Jun-2024 Qizhi Hu <836744285@qq.com>

[StructuralEquivalence] improve NTTP and CXXDependentScopeMemberExpr comparison (#95190)

improve `ASTStructuralEquivalenceTest`:

1. compare the depth and index of NTTP
2. provide comparison of `

[StructuralEquivalence] improve NTTP and CXXDependentScopeMemberExpr comparison (#95190)

improve `ASTStructuralEquivalenceTest`:

1. compare the depth and index of NTTP
2. provide comparison of `CXXDependentScopeMemberExpr` to `StmtCompare`.

Co-authored-by: huqizhi <836744285@qq.com>

show more ...


Revision tags: llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init
# 9ca1a081 18-Jan-2024 Balázs Kéri <balazs.keri@ericsson.com>

[clang][ASTImporter] Improve structural equivalence of overloadable operators. (#72242)

Operators that are overloadable may be parsed as `CXXOperatorCallExpr`
or as `UnaryOperator` (or `BinaryOpera

[clang][ASTImporter] Improve structural equivalence of overloadable operators. (#72242)

Operators that are overloadable may be parsed as `CXXOperatorCallExpr`
or as `UnaryOperator` (or `BinaryOperator`). This depends on the context
and can be different if a similar construct is imported into an existing
AST. The two "forms" of the operator call AST nodes should be detected
as equivalent to allow AST import of these cases.

This fix has probably other consequences because if a structure is
imported that has `CXXOperatorCallExpr` into an AST with an existing
similar structure that has `UnaryOperator` (or binary), the additional
data in the `CXXOperatorCallExpr` node is lost at the import (because
the existing node will be used). I am not sure if this can cause
problems.

show more ...


# 86127305 05-Jan-2024 Qizhi Hu <836744285@qq.com>

[clang][ASTImporter][StructuralEquivalence] improve StructuralEquivalence on recordType (#76226)

Types comparison in `StructuralEquivalence` ignores its `DeclContext`
when they are generated by tem

[clang][ASTImporter][StructuralEquivalence] improve StructuralEquivalence on recordType (#76226)

Types comparison in `StructuralEquivalence` ignores its `DeclContext`
when they are generated by template specialization implicitly and this
will produce incorrect result. Add comparison of `DeclContext` of
ClassTemplateSpecializationDecl to improve result.
fix [issue](https://github.com/llvm/llvm-project/issues/65913)

Co-authored-by: huqizhi <836744285@qq.com>

show more ...


Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4, llvmorg-17.0.3, llvmorg-17.0.2
# 3542168b 21-Sep-2023 Sunrise <2094247798@qq.com>

[clang][AST] fix lack comparison of declRefExpr in ASTStructuralEquivalence (#66041)

Fixed #66047
Before fix,the following testcase expected true.
```cpp
TEST_F(StructuralEquivalenceStmtTest, Dec

[clang][AST] fix lack comparison of declRefExpr in ASTStructuralEquivalence (#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
}
```

show more ...


# b8f056de 21-Sep-2023 Qizhi Hu <836744285@qq.com>

[clang][AST][ASTImporter] improve AST comparasion on VarDecl & GotoStmt (#66976)

improve AST comparasion on VarDecl & GotoStmt:
1. VarDecl should not be ignored,
2. GotoStmt has no children, i

[clang][AST][ASTImporter] improve AST comparasion on VarDecl & GotoStmt (#66976)

improve AST comparasion on VarDecl & GotoStmt:
1. VarDecl should not be ignored,
2. GotoStmt has no children, it should be handle explicitly.

Reviewed By: donat.nagy

Differential Revision: https://reviews.llvm.org/D159519

Co-authored-by: huqizhi <836744285@qq.com>

show more ...


Revision tags: llvmorg-17.0.1, llvmorg-17.0.0
# b0ea2790 08-Sep-2023 huqizhi <836744285@qq.com>

[ASTImport]CXXBoolLiteralExpr should be handled explicitly in statement comparation

In the comparation of return statement, return value(if it is
CXXBoolLiteralExpr) should be handled explicitly, ot

[ASTImport]CXXBoolLiteralExpr should be handled explicitly in statement comparation

In the comparation of return statement, return value(if it is
CXXBoolLiteralExpr) should be handled explicitly, otherwise an
incorrect result would be returned.

Reviewed By: steakhal, donat.nagy

Differential Revision: https://reviews.llvm.org/D159479

show more ...


Revision tags: llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3
# 07ab5140 22-Aug-2023 huqizhi <836744285@qq.com>

[clang][ASTImporter]Skip check depth of friend template parameter

Depth of the parameter of friend template class declaration in a
template class is 1, while in the specialization the depth is 0.
Th

[clang][ASTImporter]Skip check depth of friend template parameter

Depth of the parameter of friend template class declaration in a
template class is 1, while in the specialization the depth is 0.
This will cause failure on 'IsStructurallyEquivalent' as a name
conflict in 'VisitClassTemplateDecl'(see testcase of
'SkipComparingFriendTemplateDepth'). The patch fix it by ignore
the depth only in this special case.

Reviewed By: balazske

Differential Revision: https://reviews.llvm.org/D156693

show more ...


# afff91de 11-Aug-2023 dingfei <fding@feysh.com>

[ASTImporter][NFC] Fix typo in testcase

Differential Revision: https://reviews.llvm.org/D157637


Revision tags: llvmorg-17.0.0-rc2, llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5
# 2e16df35 26-May-2023 Volodymyr Sapsai <vsapsai@apple.com>

[ASTStructuralEquivalence] Fix crash when ObjCCategoryDecl doesn't have corresponding ObjCInterfaceDecl.

When this happens, it is invalid code and there is diagnostic
```
error: cannot find interfac

[ASTStructuralEquivalence] Fix crash when ObjCCategoryDecl doesn't have corresponding ObjCInterfaceDecl.

When this happens, it is invalid code and there is diagnostic
```
error: cannot find interface declaration for '...'
```

But clang shouldn't crash even if code is invalid. Though subsequent
diagnostic can be imperfect because without ObjCInterfaceDecl we don't have
a type for error messages.

rdar://108818430

Differential Revision: https://reviews.llvm.org/D151523

show more ...


Revision tags: llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4, llvmorg-16.0.0-rc3
# d768bf99 10-Feb-2023 Archibald Elliott <archibald.elliott@arm.com>

[NFC][TargetParser] Replace uses of llvm/Support/Host.h

The forwarding header is left in place because of its use in
`polly/lib/External/isl/interface/extract_interface.cc`, but I have
added a GCC w

[NFC][TargetParser] Replace uses of llvm/Support/Host.h

The forwarding header is left in place because of its use in
`polly/lib/External/isl/interface/extract_interface.cc`, but I have
added a GCC warning about the fact it is deprecated, because it is used
in `isl` from where it is included by Polly.

show more ...


Revision tags: llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1
# 787876b0 26-Jan-2023 Paul Robinson <paul.robinson@sony.com>

[unittests] Use GTEST_SKIP() instead of return when appropriate

Basically NFC: A TEST/TEST_F/etc that bails out early (usually because
setup failed or some other runtime condition wasn't met) genera

[unittests] Use GTEST_SKIP() instead of return when appropriate

Basically NFC: A TEST/TEST_F/etc that bails out early (usually because
setup failed or some other runtime condition wasn't met) generally
should use GTEST_SKIP() to report its status correctly, unless it
takes steps to report another status (e.g., FAIL()).

show more ...


Revision tags: llvmorg-17-init, llvmorg-15.0.7
# 13417808 21-Dec-2022 Balázs Kéri <1.int32@gmail.com>

[clang][AST] Compare UnresolvedLookupExpr in structural equivalence.

Reviewed By: gamesh411

Differential Revision: https://reviews.llvm.org/D136848


Revision tags: llvmorg-15.0.6, llvmorg-15.0.5, llvmorg-15.0.4, llvmorg-15.0.3, working, llvmorg-15.0.2, llvmorg-15.0.1, llvmorg-15.0.0, llvmorg-15.0.0-rc3, llvmorg-15.0.0-rc2
# 5674a3c8 01-Aug-2022 Gabriel Ravier <gabravier@gmail.com>

Fixed a number of typos

I went over the output of the following mess of a command:

(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z |
parallel --xargs -0 cat | aspell list --mode=none --igno

Fixed a number of typos

I went over the output of the following mess of a command:

(ulimit -m 2000000; ulimit -v 2000000; git ls-files -z |
parallel --xargs -0 cat | aspell list --mode=none --ignore-case |
grep -E '^[A-Za-z][a-z]*$' | sort | uniq -c | sort -n |
grep -vE '.{25}' | aspell pipe -W3 | grep : | cut -d' ' -f2 | less)

and proceeded to spend a few days looking at it to find probable typos
and fixed a few hundred of them in all of the llvm project (note, the
ones I found are not anywhere near all of them, but it seems like a
good start).

Differential Revision: https://reviews.llvm.org/D130827

show more ...


Revision tags: llvmorg-15.0.0-rc1, llvmorg-16-init, llvmorg-14.0.6, llvmorg-14.0.5, llvmorg-14.0.4, llvmorg-14.0.3, llvmorg-14.0.2, llvmorg-14.0.1, llvmorg-14.0.0, llvmorg-14.0.0-rc4, llvmorg-14.0.0-rc3
# 4604db94 05-Mar-2022 Volodymyr Sapsai <vsapsai@apple.com>

[ASTStructuralEquivalence] Add support for comparing ObjCCategoryDecl.

Differential Revision: https://reviews.llvm.org/D121176


Revision tags: llvmorg-14.0.0-rc2, llvmorg-14.0.0-rc1, llvmorg-15-init, llvmorg-13.0.1, llvmorg-13.0.1-rc3, llvmorg-13.0.1-rc2
# 8e8658b1 25-Nov-2021 Balázs Kéri <1.int32@gmail.com>

[clang][AST] Check context of record in structural equivalence.

The AST structural equivalence check did not differentiate between
a struct and a struct with same name in different namespace. When
t

[clang][AST] Check context of record in structural equivalence.

The AST structural equivalence check did not differentiate between
a struct and a struct with same name in different namespace. When
type of a member is checked it is possible to encounter such a case
and wrongly decide that the types are similar. This problem is fixed
by check for the namespaces of a record declaration.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D113118

show more ...


# 8804d08e 25-Nov-2021 Balázs Kéri <1.int32@gmail.com>

Revert "[clang][AST] Check context of record in structural equivalence."

Revert commit 6b96b2a0bf65ff838d4dbf909a5120d4d1083e29 because Windows
test failure.


# 6b96b2a0 24-Nov-2021 Balázs Kéri <1.int32@gmail.com>

[clang][AST] Check context of record in structural equivalence.

The AST structural equivalence check did not differentiate between
a struct and a struct with same name in different namespace. When
t

[clang][AST] Check context of record in structural equivalence.

The AST structural equivalence check did not differentiate between
a struct and a struct with same name in different namespace. When
type of a member is checked it is possible to encounter such a case
and wrongly decide that the types are similar. This problem is fixed
by check for the namespaces of a record declaration.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D113118

show more ...


Revision tags: llvmorg-13.0.1-rc1
# 01b3bd39 30-Oct-2021 Raphael Isemann <teemperor@gmail.com>

[ASTImporter] Remove ASTNodeImporter::IsStructuralMatch overload for EnumConstantDecl

1. Moves the check to ASTStructuralEquivalence.cpp like all the other checks.

2. Adds the missing checks for id

[ASTImporter] Remove ASTNodeImporter::IsStructuralMatch overload for EnumConstantDecl

1. Moves the check to ASTStructuralEquivalence.cpp like all the other checks.

2. Adds the missing checks for identifier and init expression. Also add the
respective tests for that stuff.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D112804

show more ...


Revision tags: llvmorg-13.0.0, llvmorg-13.0.0-rc4, llvmorg-13.0.0-rc3, llvmorg-13.0.0-rc2, llvmorg-13.0.0-rc1, llvmorg-14-init, llvmorg-12.0.1, llvmorg-12.0.1-rc4, llvmorg-12.0.1-rc3, llvmorg-12.0.1-rc2, llvmorg-12.0.1-rc1, llvmorg-12.0.0, llvmorg-12.0.0-rc5, llvmorg-12.0.0-rc4, llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2
# 1844ab77 02-Dec-2020 Tom Roeder <tmroeder@google.com>

[ASTImporter] Add support for importing GenericSelectionExpr AST nodes.

This allows ASTs to be merged when they contain GenericSelectionExpr
nodes (this is _Generic from C11). This is needed, for ex

[ASTImporter] Add support for importing GenericSelectionExpr AST nodes.

This allows ASTs to be merged when they contain GenericSelectionExpr
nodes (this is _Generic from C11). This is needed, for example, for
CTU analysis of C code that makes use of _Generic, like the Linux
kernel.

The node is already supported in the AST, but it didn't have a matcher
in ASTMatchers. So, this change adds the matcher and adds support to
ASTImporter. Additionally, this change adds support for structural
equivalence of _Generic in the AST.

Reviewed By: martong, aaron.ballman

Differential Revision: https://reviews.llvm.org/D92600

show more ...


Revision tags: llvmorg-11.0.1-rc1, llvmorg-11.0.0, llvmorg-11.0.0-rc6
# 007dd12d 01-Oct-2020 Gabor Marton <gabor.marton@ericsson.com>

[ASTImporter][AST] Fix structural equivalency crash on dependent FieldDecl

Differential Revision: https://reviews.llvm.org/D88665


Revision tags: llvmorg-11.0.0-rc5, llvmorg-11.0.0-rc4, llvmorg-11.0.0-rc3
# 7c4575e1 21-Sep-2020 Raphael Isemann <teemperor@gmail.com>

[ASTImporter] Refactor IsStructurallyEquivalent's Decl overloads to be more consistent

There are several `::IsStructurallyEquivalent` overloads for Decl subclasses
that are used for comparing declar

[ASTImporter] Refactor IsStructurallyEquivalent's Decl overloads to be more consistent

There are several `::IsStructurallyEquivalent` overloads for Decl subclasses
that are used for comparing declarations. There is also one overload that takes
just two Decl pointers which ends up queuing the passed Decls to be later
compared in `CheckKindSpecificEquivalence`.

`CheckKindSpecificEquivalence` implements the dispatch logic for the different
Decl subclasses. It is supposed to hand over the queued Decls to the
subclass-specific `::IsStructurallyEquivalent` overload that will actually
compare the Decl instance. It also seems to implement a few pieces of actual
node comparison logic inbetween the dispatch code.

This implementation causes that the different overloads of
`::IsStructurallyEquivalent` do different (and sometimes no) comparisons
depending on which overload of `::IsStructurallyEquivalent` ends up being
called.

For example, if I want to compare two FieldDecl instances, then I could either
call the `::IsStructurallyEquivalent` with `Decl *` or with `FieldDecl *`
parameters. The overload that takes FieldDecls is doing a correct comparison.
However, the `Decl *` overload just queues the Decl pair.
`CheckKindSpecificEquivalence` has no dispatch logic for `FieldDecl`, so it
always returns true and never does any actual comparison.

On the other hand, if I try to compare two FunctionDecl instances the two
possible overloads of `::IsStructurallyEquivalent` have the opposite behaviour:
The overload that takes `FunctionDecl` pointers isn't comparing the names of the
FunctionDecls while the overload taking a plain `Decl` ends up comparing the
function names (as the comparison logic for that is implemented in
`CheckKindSpecificEquivalence`).

This patch tries to make this set of functions more consistent by making
`CheckKindSpecificEquivalence` a pure dispatch function without any
subclass-specific comparison logic. Also the dispatch logic is now autogenerated
so it can no longer miss certain subclasses.

The comparison code from `CheckKindSpecificEquivalence` is moved to the
respective `::IsStructurallyEquivalent` overload so that the comparison result
no longer depends if one calls the `Decl *` overload or the overload for the
specific subclass. The only difference is now that the `Decl *` overload is
queuing the parameter while the subclass-specific overload is directly doing the
comparison.

`::IsStructurallyEquivalent` is an implementation detail and I don't think the
behaviour causes any bugs in the current implementation (as carefully calling
the right overload for the different classes works around the issue), so the
test for this change is that I added some new code for comparing `MemberExpr`.
The new comparison code always calls the dispatching overload and it previously
failed as the dispatch didn't support FieldDecls.

Reviewed By: martong, a_sidorin

Differential Revision: https://reviews.llvm.org/D87619

show more ...


# c0bcd110 12-Sep-2020 Raphael Isemann <teemperor@gmail.com>

[ASTImporter] Add basic support for comparing Stmts and compare function bodies

Right now the ASTImporter assumes for most Expr nodes that they are always equal
which leads to non-compatible declara

[ASTImporter] Add basic support for comparing Stmts and compare function bodies

Right now the ASTImporter assumes for most Expr nodes that they are always equal
which leads to non-compatible declarations ending up being merged. This patch
adds the basic framework for comparing Stmts (and with that also Exprs) and
implements the custom checks for a few Stmt subclasses. I'll implement the
remaining subclasses in follow up patches (mostly because there are a lot of
subclasses and some of them require further changes like having GNU language in
the testing framework)

The motivation for this is that in LLDB we try to import libc++ source code and
some of the types we are importing there contain expressions (e.g. because they
use `enable_if<expr>`), so those declarations are currently merged even if they
are completely different (e.g. `enable_if<value> ...` and `enable_if<!value>
...` are currently considered equal which is clearly not true).

Reviewed By: martong, balazske

Differential Revision: https://reviews.llvm.org/D87444

show more ...


Revision tags: llvmorg-11.0.0-rc2, llvmorg-11.0.0-rc1, llvmorg-12-init, llvmorg-10.0.1, llvmorg-10.0.1-rc4
# 85f5d126 07-Jul-2020 Balázs Kéri <1.int32@gmail.com>

[ASTImporter] Corrected import of repeated friend declarations.

Summary:
Import declarations in correct order if a class contains
multiple redundant friend (type or decl) declarations.
If the order

[ASTImporter] Corrected import of repeated friend declarations.

Summary:
Import declarations in correct order if a class contains
multiple redundant friend (type or decl) declarations.
If the order is incorrect this could cause false structural
equivalences and wrong declaration chains after import.

Reviewers: a.sidorin, shafik, a_sidorin

Reviewed By: shafik

Subscribers: dkrupp, Szelethus, gamesh411, teemperor, martong, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75740

show more ...


123