[PATCH] D46867: [ASTImporter] Add unit tests for structural equivalence

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 17 06:20:05 PDT 2018


martong marked 14 inline comments as done.
martong added a comment.

> 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.



================
Comment at: unittests/AST/StructuralEquivalenceTest.cpp:119
+      *cast<ClassTemplateDecl>(get<1>(t))->spec_begin();
+  ASSERT_TRUE(Spec0 != nullptr);
+  ASSERT_TRUE(Spec1 != nullptr);
----------------
a.sidorin wrote:
> Should we assert for `spec_begin() != spec_end()` instead or within these assertions?
I think that is not needed, because the previous `cast` in line 116 and 118 would assert if `spec_begin() == spec_end()` was  true.


================
Comment at: unittests/AST/StructuralEquivalenceTest.cpp:174
+      )";
+  auto t = makeNamedDecls( Code0, Code0, Lang_CXX);
+
----------------
a.sidorin wrote:
> 1. It's better to use more meaningful names than `t`. DeclTuple?
> 2. The space after `(` is redundant.
Renamed `t` to `Decls`.


Repository:
  rC Clang

https://reviews.llvm.org/D46867





More information about the cfe-commits mailing list