This patch fixes a stack overflow bug in ASTContext::getObjCEncodingForTypeImpl where it keeps expanding a class recursively. I added a check to avoid expanding a class if ExpandStructures is false.
Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
The fix looks reasonable to me.
Cheers,
Manman
test/CodeGenObjCXX/encode.mm | ||
---|---|---|
231 ↗ | (On Diff #65969) | I wonder if we can further reduce the testing case. Is this necessary to cause the infinite recursion? |
test/CodeGenObjCXX/encode.mm | ||
---|---|---|
231 ↗ | (On Diff #65969) | Yes. If I remove the typedef and declare "t" as a pointer to "T", clang terminates normally. If you look at the code near ASTContext.cpp:5960, you'll see getObjCEncodingForTypeImpl is called recursively only if the pointee type is a typedef, which is why the typedef is necessary to cause infinite recursion in this case. |