summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-05-22 23:19:02 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-05-22 23:19:02 +0000
commit64c0630585ac46bc3dbeb69ada50b106df8419f1 (patch)
treeccd956ca59d7242e6be2b93844dfae5d3188c431 /clang/lib
parent276d7a1434009086bb8491a58988e7818e27ecb3 (diff)
downloadbcm5719-llvm-64c0630585ac46bc3dbeb69ada50b106df8419f1.tar.gz
bcm5719-llvm-64c0630585ac46bc3dbeb69ada50b106df8419f1.zip
Avoid allocating extra memory to handle the lazy definition data pointer for
CXXRecordDecls when modules is enabled. llvm-svn: 209482
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/Decl.cpp2
-rw-r--r--clang/lib/AST/DeclCXX.cpp6
-rw-r--r--clang/lib/Serialization/ASTReaderDecl.cpp4
3 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index fc15bdee010..a783364c677 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -3240,7 +3240,7 @@ void TagDecl::startDefinition() {
struct CXXRecordDecl::DefinitionData *Data =
new (getASTContext()) struct CXXRecordDecl::DefinitionData(D);
for (auto I : redecls())
- cast<CXXRecordDecl>(I)->DefinitionData.setNotUpdated(Data);
+ cast<CXXRecordDecl>(I)->DefinitionData = Data;
}
}
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 1c416282759..0ac8b73e306 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -88,7 +88,7 @@ CXXRecordDecl::CXXRecordDecl(Kind K, TagKind TK, const ASTContext &C,
CXXRecordDecl *PrevDecl)
: RecordDecl(K, TK, C, DC, StartLoc, IdLoc, Id, PrevDecl),
DefinitionData(PrevDecl ? PrevDecl->DefinitionData
- : DefinitionDataPtr(C)),
+ : DefinitionDataPtr(this)),
TemplateOrInstantiation() {}
CXXRecordDecl *CXXRecordDecl::Create(const ASTContext &C, TagKind TK,
@@ -115,9 +115,9 @@ CXXRecordDecl::CreateLambda(const ASTContext &C, DeclContext *DC,
new (C, DC) CXXRecordDecl(CXXRecord, TTK_Class, C, DC, Loc, Loc,
nullptr, nullptr);
R->IsBeingDefined = true;
- R->DefinitionData.setNotUpdated(
+ R->DefinitionData =
new (C) struct LambdaDefinitionData(R, Info, Dependent, IsGeneric,
- CaptureDefault));
+ CaptureDefault);
R->MayHaveOutOfDateDef = false;
R->setImplicit(true);
C.getTypeDeclType(R, /*PrevDecl=*/nullptr);
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp
index d900f71c464..0c6d858bf54 100644
--- a/clang/lib/Serialization/ASTReaderDecl.cpp
+++ b/clang/lib/Serialization/ASTReaderDecl.cpp
@@ -1405,7 +1405,7 @@ void ASTDeclReader::ReadCXXRecordDefinition(CXXRecordDecl *D) {
// that all other deserialized declarations will see it.
CXXRecordDecl *Canon = D->getCanonicalDecl();
if (Canon == D) {
- D->DefinitionData.setNotUpdated(DD);
+ D->DefinitionData = DD;
D->IsCompleteDefinition = true;
} else if (auto *CanonDD = Canon->DefinitionData.getNotUpdated()) {
// We have already deserialized a definition of this record. This
@@ -1417,7 +1417,7 @@ void ASTDeclReader::ReadCXXRecordDefinition(CXXRecordDecl *D) {
D->IsCompleteDefinition = false;
MergeDefinitionData(D, *DD);
} else {
- Canon->DefinitionData.setNotUpdated(DD);
+ Canon->DefinitionData = DD;
D->DefinitionData = Canon->DefinitionData;
D->IsCompleteDefinition = true;
OpenPOWER on IntegriCloud