diff options
-rw-r--r-- | clang/lib/AST/ASTContext.cpp | 7 | ||||
-rw-r--r-- | clang/test/CodeGenObjC/encode-test-5.m | 11 |
2 files changed, 16 insertions, 2 deletions
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp index e976ccf967a..deeb7631917 100644 --- a/clang/lib/AST/ASTContext.cpp +++ b/clang/lib/AST/ASTContext.cpp @@ -2266,8 +2266,11 @@ void ASTContext::getObjCEncodingForTypeImpl(QualType T, std::string& S, S += encoding; } - } - else if (T->isObjCQualifiedIdType()) { + } else if (const ComplexType *CT = T->getAsComplexType()) { + S += 'j'; + getObjCEncodingForTypeImpl(CT->getElementType(), S, false, false, 0, false, + false); + } else if (T->isObjCQualifiedIdType()) { getObjCEncodingForTypeImpl(getObjCIdType(), S, ExpandPointedToStructures, ExpandStructures, FD); diff --git a/clang/test/CodeGenObjC/encode-test-5.m b/clang/test/CodeGenObjC/encode-test-5.m new file mode 100644 index 00000000000..970df3da878 --- /dev/null +++ b/clang/test/CodeGenObjC/encode-test-5.m @@ -0,0 +1,11 @@ +// RUN: clang-cc -triple=i686-apple-darwin9 -fnext-runtime -emit-llvm -o %t %s && + +// RUN: grep ji %t | count 1 && +char *a = @encode(_Complex int); + +// RUN: grep jf %t | count 1 && +char *b = @encode(_Complex float); + +// RUN: grep jd %t | count 1 +char *c = @encode(_Complex double); + |