Shafik found out that importing a CXXConstructorDecl will create a translation unit that
causes Clang's CodeGen to crash. The reason for that is that we don't copy the OperatorDelete
from the CXXConstructorDecl when importing. This patch fixes it and adds a test case for that.
Details
Diff Detail
- Repository
- rC Clang
Event Timeline
Didn't really upstream any non-trivial ASTImporter patches yet, so please point out any style errors.
Thank you, this looks good but perhaps some refactoring would help improve the change.
lib/AST/ASTImporter.cpp | ||
---|---|---|
3258 | I am not sure I agree. Having everything in VisitFunctionDecl makes this code harder to maintain. | |
3261 | At what point in VisitFunctionDecl would you expect this change to bail out of? A possible refactor would be to move this code to a separate function and then call that function at that point in VisitFunctionDecl. This would prevent VisitFunctionDecl from becoming even larger and I think address your concern. |
Hi Shafik,
Please find my answers inline.
lib/AST/ASTImporter.cpp | ||
---|---|---|
3258 | That's true, but I think it's better to put FunctionDecl refactoring as a separate commit - it would be bigger than just putting some related stuff to the original function. We have the same problem with VisitRecordDecl, but, unfortunately, I still had no time to rearrange this stuff. | |
3261 | Just before line 3096, where a new dtor decl is being created. |
- Moved code into the VisitFunctionDecl function.
I don't mind if we clean up that function in a later commit. Thanks for the feedback!
LGTM, thank you!
I'm sorry if the change I requested doesn't look good, but I think the correctness is our priority.
It's better to move this code to VisitFunctionDecl to keep all related stuff together.