summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2016-01-06 22:34:54 +0000
committerJohn McCall <rjmccall@apple.com>2016-01-06 22:34:54 +0000
commit32791cc3e1529efe8ac348eafc94910d421683fc (patch)
treef87aa3bbefaf37a359cfccc9ee5c927cb3ba0031 /clang/lib/Frontend
parenta43eacbf9ec8027b18ffef1b768f8303e4ffc7cf (diff)
downloadbcm5719-llvm-32791cc3e1529efe8ac348eafc94910d421683fc.tar.gz
bcm5719-llvm-32791cc3e1529efe8ac348eafc94910d421683fc.zip
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 llvm-svn: 256983
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/MultiplexConsumer.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Frontend/MultiplexConsumer.cpp b/clang/lib/Frontend/MultiplexConsumer.cpp
index 12c85240bd7..f8b73e9034b 100644
--- a/clang/lib/Frontend/MultiplexConsumer.cpp
+++ b/clang/lib/Frontend/MultiplexConsumer.cpp
@@ -119,6 +119,7 @@ public:
const FunctionDecl *Delete) override;
void CompletedImplicitDefinition(const FunctionDecl *D) override;
void StaticDataMemberInstantiated(const VarDecl *D) override;
+ void DefaultArgumentInstantiated(const ParmVarDecl *D) override;
void AddedObjCCategoryToInterface(const ObjCCategoryDecl *CatD,
const ObjCInterfaceDecl *IFD) override;
void FunctionDefinitionInstantiated(const FunctionDecl *D) override;
@@ -193,6 +194,11 @@ void MultiplexASTMutationListener::StaticDataMemberInstantiated(
for (size_t i = 0, e = Listeners.size(); i != e; ++i)
Listeners[i]->StaticDataMemberInstantiated(D);
}
+void MultiplexASTMutationListener::DefaultArgumentInstantiated(
+ const ParmVarDecl *D) {
+ for (size_t i = 0, e = Listeners.size(); i != e; ++i)
+ Listeners[i]->DefaultArgumentInstantiated(D);
+}
void MultiplexASTMutationListener::AddedObjCCategoryToInterface(
const ObjCCategoryDecl *CatD,
const ObjCInterfaceDecl *IFD) {
OpenPOWER on IntegriCloud