Consistently create a new declaration when merging a pre-existing but
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 12 Sep 2018 02:13:47 +0000 (02:13 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 12 Sep 2018 02:13:47 +0000 (02:13 +0000)
commitc457766c6d739ba717f881b36a76ff60d3b75809
tree294731666a45d2531fbf35de0720e1585d01ccde
parent20fbdb347cf6324e6e8d3f4aa1d0b1ab02f70e8d
Consistently create a new declaration when merging a pre-existing but
hidden definition with a would-be-parsed redefinition.

This permits a bunch of cleanups. In particular, we no longer need to
take merged definitions into account when checking declaration
visibility, only when checking definition visibility, which makes
certain visibility checks take linear instead of quadratic time.

We could also now remove the UPD_DECL_EXPORTED update record and track
on each declaration whether it was demoted from a definition (as we
already do for variables), but I'm not doing that in this patch to keep
the changes here simpler.

llvm-svn: 342018
clang/include/clang/Sema/Sema.h
clang/lib/AST/ASTDumper.cpp
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaDeclCXX.cpp
clang/lib/Sema/SemaLookup.cpp
clang/lib/Sema/SemaTemplate.cpp
clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
clang/lib/Sema/SemaType.cpp
clang/test/Modules/submodules-merge-defs.cpp