]> granicus.if.org Git - clang/commit
[ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs
authorAkira Hatanaka <ahatanaka@apple.com>
Wed, 29 May 2019 21:23:30 +0000 (21:23 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Wed, 29 May 2019 21:23:30 +0000 (21:23 +0000)
commitd64e6eeea912442cc75aa09d187bbdb9340d7fb7
treef15f3bc5afb20fe3494f500d1ae9f494c68c7b87
parent2713d755f233be02f536332ab532d3776cdc6293
[ObjC] Fix encoding of ObjC pointer types that are pointers to typedefs

clang was encoding pointers to typedefs as if they were pointers to
structs because that is apparently what gcc is doing.

For example:

```
@class Class1;

typedef NSArray<Class1 *> MyArray;

void foo1(void) {
  const char *s0 = @encode(MyArray *); // "^{NSArray=#}"
  const char *s1 = @encode(NSArray<Class1 *> *); // "@"
}
```

This commit removes the code that was there to make clang compatible
with gcc and make clang emit the correct encoding for ObjC pointers,
which is "@".

rdar://problem/50563529

Differential Revision: https://reviews.llvm.org/D61974

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@362034 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/ASTContext.h
lib/AST/ASTContext.cpp
test/CodeGenObjC/encode-test-6.m
test/CodeGenObjC/encode-test.m
test/CodeGenObjCXX/encode.mm