[PATCH] D75740: [ASTImporter] Corrected import of repeated friend declarations.

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 9 08:03:23 PDT 2020


balazske marked 9 inline comments as done.
balazske added inline comments.


================
Comment at: clang/lib/AST/ASTImporter.cpp:3640
+  auto *RD = cast<CXXRecordDecl>(FD->getLexicalDeclContext());
+  if (FD->getFriendType()) {
+    QualType TypeOfFriend = FD->getFriendType()->getType().getCanonicalType();
----------------
a_sidorin wrote:
> ```if (const TypeSourceInfo *FriendType = FD->getFriendType()) {
>     QualType TypeOfFriend = FriendType->getType().getCanonicalType();
> ...```
> ?
In the current way the branches (after `if` and `else`) look relatively similar, I like that better.


================
Comment at: clang/lib/AST/ASTImporter.cpp:3699
+
+  assert(ImportedEquivalentFriends.size() <= std::get<0>(CountAndPosition) &&
+         "Class with non-matching friends is imported, ODR check wrong?");
----------------
a_sidorin wrote:
> Why not strictly equal?
`D` id the Decl to be imported, `ImportedEquivalentFriends` contains the similar friends already  imported. This may be less than the total (0 at first time) if not all friends are imported yet (should be a temporary state). The next line checks for equality.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D75740





More information about the cfe-commits mailing list