[PATCH] D59665: Call to HandleNameConflict in VisitEnumDecl mistakeningly using Name instead of SearchName

Shafik Yaghmour via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 26 10:10:48 PDT 2019


shafik marked an inline comment as done.
shafik added a comment.

In D59665#1442826 <https://reviews.llvm.org/D59665#1442826>, @martong wrote:

> In D59665#1442328 <https://reviews.llvm.org/D59665#1442328>, @shafik wrote:
>
> > @martong your idea does not work b/c default construction `DeclarationName()` treats it the same as being empty. So `if (!Name)` is still `true`.
>
>
> And did you try moving the `push_back` to the other scope? I'd expect the the ConflictingDecls to be empty then.


Yes, I did and I think it looks good but I have to run a regression.



================
Comment at: lib/AST/ASTImporter.cpp:2463
     if (!ConflictingDecls.empty()) {
-      Name = Importer.HandleNameConflict(Name, DC, IDNS,
+      Name = Importer.HandleNameConflict(SearchName, DC, IDNS,
                                          ConflictingDecls.data(),
----------------
martong wrote:
> shafik wrote:
> > a_sidorin wrote:
> > > If I understand correctly, this will replace Name with SearchName causing an anonymous enum to be imported as a named a few lines below. It doesn't look like a correct behaviour to me.
> > This is correct because either `SearchName` is `Name` or it is the name of the typedef for the anonymous enum set via `ImportInto(SearchName, D->getTypedefNameForAnonDecl()->getDeclName())`
> Okay, this is indeed correct. But then we should make a similar change in VisitRecordDecl too (there we do exactly the same with typedefs).
This is fixing a specific bug, so I would want to keep this change specifically related to that and I can add a second review for `VisitRecordDecl`


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

https://reviews.llvm.org/D59665





More information about the cfe-commits mailing list