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.
a.sidorin r.stahl martong xazax.hun
- 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…
LGTM, just found some minor things.
|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.