mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-14 09:56:33 +00: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
29 lines
873 B
C++
29 lines
873 B
C++
// RUN: rm -rf %t
|
|
// RUN: mkdir %t
|
|
// RUN: echo 'namespace N { enum E { A }; }' > %t/a.h
|
|
// RUN: echo '#include "a.h"' > %t/b.h
|
|
// RUN: touch %t/x.h
|
|
// RUN: echo 'module B { module b { header "b.h" } module x { header "x.h" } }' > %t/b.modulemap
|
|
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x c++ -fmodule-map-file=%t/b.modulemap %s -I%t -verify -fmodules-local-submodule-visibility
|
|
// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -x c++ -fmodule-map-file=%t/b.modulemap %s -I%t -verify -fmodules-local-submodule-visibility -DMERGE_LATE
|
|
|
|
#ifndef MERGE_LATE
|
|
// expected-no-diagnostics
|
|
#include "a.h"
|
|
#endif
|
|
|
|
#include "x.h"
|
|
|
|
#ifdef MERGE_LATE
|
|
namespace N {
|
|
enum { A } a; // expected-note {{candidate}}
|
|
// expected-note@a.h:1 {{candidate}} (from module B.b)
|
|
}
|
|
#include "a.h"
|
|
#endif
|
|
|
|
N::E e = N::A;
|
|
#ifdef MERGE_LATE
|
|
// expected-error@-2 {{ambiguous}}
|
|
#endif
|