diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-13 05:14:45 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2015-11-13 05:14:45 +0000 |
| commit | 6e132bef6fd1625bd214b49a198b78ca1c4d5a4d (patch) | |
| tree | e0e72ae43078923fc71a2fdf8847bf5c5d8a94e9 | |
| parent | 978cbc54bc17082d3d2f42e92e7ed554037588b6 (diff) | |
| download | bcm5719-llvm-6e132bef6fd1625bd214b49a198b78ca1c4d5a4d.tar.gz bcm5719-llvm-6e132bef6fd1625bd214b49a198b78ca1c4d5a4d.zip | |
[modules] When a declaration has non-trivial visibility, check whether it's
actually hidden before we check its linkage. This avoids computing the linkage
"too early" for an anonymous struct with a typedef name for linkage.
llvm-svn: 253012
| -rw-r--r-- | clang/include/clang/Sema/Lookup.h | 3 | ||||
| -rw-r--r-- | clang/test/Modules/submodule-visibility.cpp | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/clang/include/clang/Sema/Lookup.h b/clang/include/clang/Sema/Lookup.h index f291a8aef05..87c40f0cf20 100644 --- a/clang/include/clang/Sema/Lookup.h +++ b/clang/include/clang/Sema/Lookup.h @@ -303,8 +303,7 @@ public: if (!D->isInIdentifierNamespace(IDNS)) return nullptr; - if (!D->isHidden() || isHiddenDeclarationVisible(D) || - isVisibleSlow(getSema(), D)) + if (isVisible(getSema(), D) || isHiddenDeclarationVisible(D)) return D; return getAcceptableDeclSlow(D); diff --git a/clang/test/Modules/submodule-visibility.cpp b/clang/test/Modules/submodule-visibility.cpp index b2c5fc7ba19..345ae155bb3 100644 --- a/clang/test/Modules/submodule-visibility.cpp +++ b/clang/test/Modules/submodule-visibility.cpp @@ -28,3 +28,10 @@ int k = n + m; // OK, a and b are visible here. #ifndef B #error B is not defined #endif + +// Ensure we don't compute the linkage of this struct before we find it has a +// typedef name for linkage purposes. +typedef struct { + int p; + void (*f)(int p); +} name_for_linkage; |

