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
Showing
- include/clang/AST/ASTMutationListener.h 4 additions, 0 deletionsinclude/clang/AST/ASTMutationListener.h
- include/clang/AST/ExprCXX.h 5 additions, 30 deletionsinclude/clang/AST/ExprCXX.h
- include/clang/Serialization/ASTWriter.h 1 addition, 0 deletionsinclude/clang/Serialization/ASTWriter.h
- lib/AST/ExprCXX.cpp 0 additions, 8 deletionslib/AST/ExprCXX.cpp
- lib/Frontend/MultiplexConsumer.cpp 6 additions, 0 deletionslib/Frontend/MultiplexConsumer.cpp
- lib/Sema/SemaExpr.cpp 8 additions, 1 deletionlib/Sema/SemaExpr.cpp
- lib/Serialization/ASTCommon.h 1 addition, 0 deletionslib/Serialization/ASTCommon.h
- lib/Serialization/ASTReaderDecl.cpp 15 additions, 0 deletionslib/Serialization/ASTReaderDecl.cpp
- lib/Serialization/ASTReaderStmt.cpp 3 additions, 13 deletionslib/Serialization/ASTReaderStmt.cpp
- lib/Serialization/ASTWriter.cpp 14 additions, 0 deletionslib/Serialization/ASTWriter.cpp
- lib/Serialization/ASTWriterStmt.cpp 0 additions, 7 deletionslib/Serialization/ASTWriterStmt.cpp
- test/PCH/chain-default-argument-instantiation.cpp 50 additions, 0 deletionstest/PCH/chain-default-argument-instantiation.cpp
- test/SemaCXX/conversion.cpp 3 additions, 4 deletionstest/SemaCXX/conversion.cpp
- test/SemaTemplate/default-arguments-cxx0x.cpp 19 additions, 0 deletionstest/SemaTemplate/default-arguments-cxx0x.cpp
Loading
Please register or sign in to comment