[PATCH] D60934: [clang] adding explicit(bool) from c++2a

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 26 08:11:30 PDT 2019


martong added inline comments.


================
Comment at: clang/lib/AST/ASTStructuralEquivalence.cpp:965
     auto *Conversion2 = cast<CXXConversionDecl>(Method2);
-    if (Conversion1->isExplicit() != Conversion2->isExplicit())
+    if (!Conversion1->isEquivalentExplicit(Conversion2->getExplicitSpecifier()))
       return false;
----------------
martong wrote:
> Would it work if `Method1` has a different `ASTContext` than `Method2?
> That is exactly the case when we import an AST into another with ASTImporter.
`isEquivalentExplicit` calls `EquivalentExplicit`, which in turn calls `Stmt::Profile`.
Seems like `Stmt::Profile` relies on pointer equivalencies, however, here we may have two different `ASTContext`s for each Method, so we must not rely on pointer values.
I suggest to use a version of `EquivalentExplicit` which uses `Stmt::ProcessODRHash`, that one does not rely on pointer values.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60934/new/

https://reviews.llvm.org/D60934





More information about the cfe-commits mailing list