Importing a function having a struct definition in the parameter list causes a crash in the importer via infinite recursion. This patch avoids the crash and reports such functions as not supported. Unit tests make sure that normal struct definitions inside function bodies work normally on the other hand and LLDB-like type imports also do.
Details
- Reviewers
a.sidorin r.stahl martong xazax.hun - Commits
- rG6e1510cfeb2e: [ASTImporter] Fix infinite recursion on function import with struct definition…
rC336898: [ASTImporter] Fix infinite recursion on function import with struct definition…
rL336898: [ASTImporter] Fix infinite recursion on function import with struct definition…
Diff Detail
- Repository
- rL LLVM
Event Timeline
Problem: This change interferes with https://reviews.llvm.org/D47445. Probably that should be committed, it is approved already.
Ok. I'll wait for the other thing to be committed and I will rework this immediately. Thanks for telling.
Updated to not conflict with and use the stuff implemented in https://reviews.llvm.org/D47445 (so became a bit smaller)
Now, it is ready for a review. Enjoy!
LGTM, just found some minor things.
unittests/AST/ASTImporterTest.cpp | ||
---|---|---|
174 ↗ | (On Diff #151533) | Now that the Importer is moved under the TU struct it is not that trivial so I think we should add a few more comments to it. Represents a "From" translation unit and holds an importer object which we use to import from this translation unit. Also there is an invariant which should be forced: the "To" and the "From" context of the Importer must remain the same throughout the life time of any TU object. We can achieve that with an assert in lazyInitImporter. (What's more, the different objects all should have the same "To" contexts, but that could be checked only in the TestBase and looks more difficult, so for this patch we could skip that. ) |
190 ↗ | (On Diff #151533) | I think, if there is an existing Importer then we should assert whether that has a ToASTwhich is equal to the parameter. |
unittests/AST/ASTImporterTest.cpp | ||
---|---|---|
234 ↗ | (On Diff #152055) | Sure, thank you. |