This patch add new tests for structural equivalence. For that a new common header is created which holds the test related language specific types and functions.
Details
Diff Detail
- Repository
- rC Clang
Event Timeline
Hello Gabor!
Thank you for this patch! Do you plan to enable this functionality for AST import checking?
Some comments are inline.
unittests/AST/Language.h | ||
---|---|---|
2 | Header line is too short. | |
9 | Could you please add a brief file description? | |
14 | System includes should follow LLVM includes. | |
38 | I think this function is too big for a header. Same below. Could you create a source file? | |
unittests/AST/StructuralEquivalenceTest.cpp | ||
3 | Do we need ASTImporter.h? | |
40 | s/Import/Search? | |
48 | Nit: comments should end with dot. Could you please check? | |
49 | Can we assert(FoundDecls.size() == 1)? | |
55 | D0, D1 (capital). Same below. | |
74 | Could we just overload testStructuralMatch to accept tuple or pair? | |
120 | Should we assert for spec_begin() != spec_end() instead or within these assertions? | |
164 | There is no Code1, so I think we can call it just "Code". Same below. | |
175 |
| |
194 | Redundant space. Could you clang-format? | |
196 | These assertions are always true because there is a strong C assertion in the callee. |
Do you plan to enable this functionality for AST import checking?
Yes. We'd like to test the structural equivalency independently from ASTImporter, because in certain cases it may have faulty behavior. This can be very handy also when we further extend structural equivalency.
unittests/AST/StructuralEquivalenceTest.cpp | ||
---|---|---|
120 | I think that is not needed, because the previous cast in line 116 and 118 would assert if spec_begin() == spec_end() was true. | |
175 | Renamed t to Decls. |
Hi Gabor,
LGTM, thank you for addressing the comments! Just a minor nit, it's OK to fix it before committing without a separate review.
unittests/AST/StructuralEquivalenceTest.cpp | ||
---|---|---|
68 | Not sure we need this using: we can move up the using below or just write std::get twice. |
Header line is too short.