[PATCH] D31778: [Modules] Implement ODR-like semantics for tag types in C/ObjC
Bruno Cardoso Lopes via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 30 09:54:56 PDT 2017
bruno updated this revision to Diff 104881.
bruno added a comment.
> Digging into this a bit more, I think the root of the problem is that the `ND->isExternallyVisible()` call in `LookupResult::isHiddenDeclarationVisible` is wrong. Redeclaration lookup should never find hidden enumerators in C, because they do not have linkage (C11 6.2.2/6). (The same is true in C++, but I don't know whether we can apply the same thing there too, due to the different
merging rules.) A function foo in some source file should not conflict with an enumerator foo in a non-imported module, for instance.
> The linkage of an enumerator should probably be VisibleNoLinkage, and isHiddenDeclarationVisible should probably be checking hasExternalFormalLinkage...
Implemented this suggestions from last round of review. Change didn't seem to have side effects (at least from clang tests). @rsmith, what do you think? (I should probably split this small change into a different commit when the patch is accepted)
https://reviews.llvm.org/D31778
Files:
include/clang/AST/ASTStructuralEquivalence.h
include/clang/Basic/DiagnosticASTKinds.td
include/clang/Basic/Visibility.h
include/clang/Sema/Lookup.h
include/clang/Sema/Sema.h
lib/AST/ASTStructuralEquivalence.cpp
lib/AST/Decl.cpp
lib/Parse/ParseDecl.cpp
lib/Parse/ParseDeclCXX.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaType.cpp
test/Index/linkage.c
test/Modules/Inputs/F.framework/Headers/F.h
test/Modules/Inputs/F.framework/Modules/module.modulemap
test/Modules/Inputs/F.framework/Modules/module.private.modulemap
test/Modules/Inputs/F.framework/PrivateHeaders/NS.h
test/Modules/elaborated-type-specifier-from-hidden-module.m
test/Modules/redefinition-c-tagtypes.m
test/Modules/redefinition-same-header.m
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31778.104881.patch
Type: text/x-patch
Size: 29220 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170630/4c727403/attachment-0001.bin>
More information about the cfe-commits
mailing list