]> granicus.if.org Git - clang/commit
PR33924: merge local declarations that have linkage of some kind within
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 4 Jul 2018 02:25:38 +0000 (02:25 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 4 Jul 2018 02:25:38 +0000 (02:25 +0000)
commitef356db5c03a0f052c09ebd0a964b9eda3852847
tree28fbb44d59ddb9c84297007d9191b53710a1b53f
parent2926189c9bf4982cd6a0e9cc00d785837112d457
PR33924: merge local declarations that have linkage of some kind within
merged function definitions; also merge functions with deduced return
types.

This seems like two independent fixes, but unfortunately they are hard
to separate because it's challenging to reliably test either one of them
without also testing the other.

A complication arises with deduced return type support: we need the type
of the function in order to know how to merge it, but we can't load the
actual type of the function because it might reference an entity
declared within the function (and we need to have already merged the
function to correctly merge that entity, which we would need to do to
determine if the function types match). So we instead compare the
declared function type when merging functions, and defer loading the
actual type of a function with a deduced type until we've finished
loading and merging the function.

This reverts r336175, reinstating r336021, with one change (for PR38015):
we look at the TypeSourceInfo of the first-so-far declaration of each
function when considering whether to merge two functions. This works
around a problem where the calling convention in the TypeSourceInfo for
subsequent redeclarations may not match if it was implicitly adjusted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336240 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Serialization/ASTReader.h
lib/Serialization/ASTCommon.cpp
lib/Serialization/ASTReaderDecl.cpp
test/Modules/cxx-dtor.cpp
test/Modules/friend-definition-2.cpp
test/Modules/merge-deduced-return.cpp [new file with mode: 0644]
test/Modules/merge-lambdas.cpp [new file with mode: 0644]
test/Modules/merge-static-locals.cpp [new file with mode: 0644]
test/Modules/pr27401.cpp