[PATCH] D39886: [ASTImporter] Fix wrong conflict detections for unnamed structures

Aleksei Sidorin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 13 04:23:24 PST 2017


a.sidorin added a comment.

Hello Takafumi,

Thank you for this patch. Looks like you're trying to disable lookup for similar structures if the structure is anonymous but there are two things I'm worrying about this solution.

1. Are import conflicts for anonymous structures resolved correctly?
2. Are equal structures present in both TUs imported correctly, without duplication?

Could you please check this and add tests if possible?



================
Comment at: lib/AST/ASTImporter.cpp:1634
   RecordDecl *PrevDecl = nullptr;
-  if (!DC->isFunctionOrMethod()) {
+  if (!DC->isFunctionOrMethod() && SearchName.getAsString() != "") {
     SmallVector<NamedDecl *, 4> ConflictingDecls;
----------------
D->isAnonymousStructOrUnion()?


================
Comment at: unittests/AST/ASTImporterTest.cpp:503
+                has(
+                declStmt(
+                  has(
----------------
Broken indentation?


https://reviews.llvm.org/D39886





More information about the cfe-commits mailing list