r253012 - [modules] When a declaration has non-trivial visibility, check whether it's
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 12 21:14:45 PST 2015
Author: rsmith
Date: Thu Nov 12 23:14:45 2015
New Revision: 253012
URL: http://llvm.org/viewvc/llvm-project?rev=253012&view=rev
Log:
[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.
Modified:
cfe/trunk/include/clang/Sema/Lookup.h
cfe/trunk/test/Modules/submodule-visibility.cpp
Modified: cfe/trunk/include/clang/Sema/Lookup.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Lookup.h?rev=253012&r1=253011&r2=253012&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Lookup.h (original)
+++ cfe/trunk/include/clang/Sema/Lookup.h Thu Nov 12 23:14:45 2015
@@ -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);
Modified: cfe/trunk/test/Modules/submodule-visibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/submodule-visibility.cpp?rev=253012&r1=253011&r2=253012&view=diff
==============================================================================
--- cfe/trunk/test/Modules/submodule-visibility.cpp (original)
+++ cfe/trunk/test/Modules/submodule-visibility.cpp Thu Nov 12 23:14:45 2015
@@ -28,3 +28,10 @@ int k = n + m; // OK, a and b are visibl
#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;
More information about the cfe-commits
mailing list