Douglas Gregor | 5536891 | 2011-12-14 16:03:29 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
Douglas Gregor | 6bd9929 | 2013-02-09 01:35:03 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fmodules -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify |
Douglas Gregor | 5536891 | 2011-12-14 16:03:29 +0000 | [diff] [blame] | 3 | |
Andy Gibbs | b42f200 | 2013-04-17 08:06:46 +0000 | [diff] [blame] | 4 | // expected-note@Inputs/def.h:5 {{previous definition is here}} |
Douglas Gregor | d07cc36 | 2012-01-02 17:18:37 +0000 | [diff] [blame] | 5 | |
Douglas Gregor | 6bd9929 | 2013-02-09 01:35:03 +0000 | [diff] [blame] | 6 | @class Def; |
| 7 | Def *def; |
| 8 | class Def2; |
| 9 | Def2 *def2; |
| 10 | |
| 11 | @interface Unrelated |
| 12 | - defMethod; |
| 13 | @end |
| 14 | |
Douglas Gregor | 1b257af | 2012-12-11 22:11:52 +0000 | [diff] [blame] | 15 | @import decldef; |
Douglas Gregor | 5536891 | 2011-12-14 16:03:29 +0000 | [diff] [blame] | 16 | A *a1; // expected-error{{unknown type name 'A'}} |
| 17 | B *b1; // expected-error{{unknown type name 'B'}} |
Douglas Gregor | 1b257af | 2012-12-11 22:11:52 +0000 | [diff] [blame] | 18 | @import decldef.Decl; |
Douglas Gregor | 5536891 | 2011-12-14 16:03:29 +0000 | [diff] [blame] | 19 | |
Douglas Gregor | d63348c | 2011-12-15 20:36:27 +0000 | [diff] [blame] | 20 | A *a2; |
Douglas Gregor | 5536891 | 2011-12-14 16:03:29 +0000 | [diff] [blame] | 21 | B *b; |
| 22 | |
Douglas Gregor | d07cc36 | 2012-01-02 17:18:37 +0000 | [diff] [blame] | 23 | void testA(A *a) { |
Douglas Gregor | ca2ab45 | 2013-01-12 01:29:50 +0000 | [diff] [blame] | 24 | a->ivar = 17; // expected-error{{definition of 'A' must be imported from module 'decldef.Def' before it is required}} |
Douglas Gregor | d07cc36 | 2012-01-02 17:18:37 +0000 | [diff] [blame] | 25 | } |
| 26 | |
Douglas Gregor | 5536891 | 2011-12-14 16:03:29 +0000 | [diff] [blame] | 27 | void testB() { |
Douglas Gregor | ca2ab45 | 2013-01-12 01:29:50 +0000 | [diff] [blame] | 28 | B b; // Note: redundant error silenced |
Douglas Gregor | 5536891 | 2011-12-14 16:03:29 +0000 | [diff] [blame] | 29 | } |
Douglas Gregor | 6bd9929 | 2013-02-09 01:35:03 +0000 | [diff] [blame] | 30 | |
| 31 | void testDef() { |
| 32 | [def defMethod]; |
| 33 | } |
| 34 | |
| 35 | void testDef2() { |
| 36 | def2->func(); |
| 37 | } |