mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-28 07:49:01 -04:00

declarations in redeclaration lookup. A declaration is now visible to lookup if: * It is visible (not in a module, or in an imported module), or * We're doing redeclaration lookup and it's externally-visible, or * We're doing typo correction and looking for unimported decls. We now support multiple modules having different internal-linkage or no-linkage definitions of the same name for all entities, not just for functions, variables, and some typedefs. As previously, if multiple such entities are visible, any attempt to use them will result in an ambiguity error. This patch fixes the linkage calculation for a number of entities where we previously didn't need to get it right (using-declarations, namespace aliases, and so on). It also classifies enumerators as always having no linkage, which is a slight deviation from the C++ standard's definition, but not an observable change outside modules (this change is being discussed on the -core reflector currently). This also removes the prior special case for tag lookup, which made some cases of this work, but also led to bizarre, bogus "must use 'struct' to refer to type 'Foo' in this scope" diagnostics in C++. llvm-svn: 252960
40 lines
1.0 KiB
Objective-C
40 lines
1.0 KiB
Objective-C
// RUN: rm -rf %t
|
|
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify -DUSE_EARLY
|
|
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fobjc-arc -I %S/Inputs -fmodules-cache-path=%t %s -verify
|
|
|
|
// expected-note@Inputs/def.h:5 {{previous}}
|
|
|
|
@class Def;
|
|
Def *def;
|
|
|
|
@import decldef;
|
|
#ifdef USE_EARLY
|
|
A *a1; // expected-error{{declaration of 'A' must be imported from module 'decldef.Def' before it is required}}
|
|
#endif
|
|
B *b1;
|
|
#ifdef USE_EARLY
|
|
// expected-error@-2{{must use 'struct' tag to refer to type 'B'}}
|
|
#else
|
|
// expected-error@-4{{declaration of 'B' must be imported from module 'decldef.Decl' before it is required}}
|
|
// expected-note@Inputs/decl.h:2 {{previous}}
|
|
#endif
|
|
@import decldef.Decl;
|
|
|
|
A *a2;
|
|
struct B *b;
|
|
|
|
void testA(A *a) {
|
|
a->ivar = 17;
|
|
#ifndef USE_EARLY
|
|
// expected-error@-2{{definition of 'A' must be imported from module 'decldef.Def' before it is required}}
|
|
#endif
|
|
}
|
|
|
|
void testB() {
|
|
B b; // Note: redundant error silenced
|
|
}
|
|
|
|
void testDef() {
|
|
[def defMethod];
|
|
}
|