Files
clang-p2996/clang/test/PCH/objc_import.m
Argyrios Kyrtzidis dd7106375c When declaring an ObjC interface decl with a @compatibility_alias alias name, change the class name to the "real" one.
If we have something like

  @class NewImage;
  @compatibility_alias OldImage NewImage;
  @class OldImage;

the lookup for 'OldImage' will return the 'NewImage' decl ("@class NewImage").
In such a case, when creating the decl for "@class OldImage" use the real declaration name ("NewImage"),
instead of the alias one ("OldImage"), otherwise we will break IdentifierResolver and redecls-chain invariants.

Fixes crash of rdar://14112291.

llvm-svn: 184238
2013-06-18 21:26:33 +00:00

33 lines
562 B
Objective-C

// Test this without pch.
// RUN: %clang_cc1 -include %S/objc_import.h -fsyntax-only -verify %s
// Test with pch.
// RUN: %clang_cc1 -x objective-c -emit-pch -o %t %S/objc_import.h
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify %s
// expected-no-diagnostics
#import "objc_import.h"
void func() {
TestPCH *xx;
xx = [TestPCH alloc];
[xx instMethod];
}
// rdar://14112291
@class NewID1;
void foo1(NewID1 *p);
void bar1(OldID1 *p) {
foo1(p);
}
@class NewID2;
void foo2(NewID2 *p) {
[p meth];
}
void bar2(OldID2 *p) {
foo2(p);
[p meth];
}