[PATCH] D22929: [CodeGen][ObjC] Fix infinite recursion in getObjCEncodingForTypeImpl

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 16 14:53:57 PDT 2016


ahatanak added inline comments.

================
Comment at: test/CodeGenObjCXX/encode.mm:231
@@ +230,3 @@
+struct S {
+  typedef T Ty;
+  Ty *t;
----------------
manmanren wrote:
> I wonder if we can further reduce the testing case. Is this necessary to cause the infinite recursion?
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.


https://reviews.llvm.org/D22929





More information about the cfe-commits mailing list