]> granicus.if.org Git - clang/commit
Only instantiate a default argument once.
authorJohn McCall <rjmccall@apple.com>
Wed, 6 Jan 2016 22:34:54 +0000 (22:34 +0000)
committerJohn McCall <rjmccall@apple.com>
Wed, 6 Jan 2016 22:34:54 +0000 (22:34 +0000)
commitd201541db4135d160d249eb86e3d0718285903a2
tree6ebf2abcfe52012cd420130be35fc32093b83b25
parent8c1b069d417d337d7468283f71b416d87613b00f
Only instantiate a default argument once.

By storing the instantiated expression back in the ParmVarDecl,
we remove the last need for separately storing the sub-expression
of a CXXDefaultArgExpr.  This makes PCH/Modules merging quite
simple: CXXDefaultArgExpr records are serialized as references
to the ParmVarDecl, and we ignore redundant attempts to overwrite
the instantiated expression.

This has some extremely marginal impact on user-facing semantics.
However, the major effect is that it avoids IRGen errors about
conflicting definitions due to lambdas in the argument being
instantiated multiple times while sharing the same mangling.
It should also slightly improve memory usage and module file size.

rdar://23810407

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@256983 91177308-0d34-0410-b5e6-96231b3b80d8
14 files changed:
include/clang/AST/ASTMutationListener.h
include/clang/AST/ExprCXX.h
include/clang/Serialization/ASTWriter.h
lib/AST/ExprCXX.cpp
lib/Frontend/MultiplexConsumer.cpp
lib/Sema/SemaExpr.cpp
lib/Serialization/ASTCommon.h
lib/Serialization/ASTReaderDecl.cpp
lib/Serialization/ASTReaderStmt.cpp
lib/Serialization/ASTWriter.cpp
lib/Serialization/ASTWriterStmt.cpp
test/PCH/chain-default-argument-instantiation.cpp [new file with mode: 0644]
test/SemaCXX/conversion.cpp
test/SemaTemplate/default-arguments-cxx0x.cpp