summaryrefslogtreecommitdiff
path: root/lib/AST
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-08-08 16:53:22 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-08-08 16:53:22 +0000
commitffe56ea4c355b82c6fdbed4befc7fe3b956e35a2 (patch)
tree5cf1c5e9dcf25a5774d7a5c693d056f63e855ffa /lib/AST
parent104a02fb6c96111ce06b53e282adfb2b4a59eeb6 (diff)
Notes
Diffstat (limited to 'lib/AST')
-rw-r--r--lib/AST/ODRHash.cpp8
-rw-r--r--lib/AST/StmtCXX.cpp14
2 files changed, 20 insertions, 2 deletions
diff --git a/lib/AST/ODRHash.cpp b/lib/AST/ODRHash.cpp
index b19135384cfd..121724a73152 100644
--- a/lib/AST/ODRHash.cpp
+++ b/lib/AST/ODRHash.cpp
@@ -378,8 +378,12 @@ void ODRHash::AddCXXRecordDecl(const CXXRecordDecl *Record) {
assert(Record && Record->hasDefinition() &&
"Expected non-null record to be a definition.");
- if (isa<ClassTemplateSpecializationDecl>(Record)) {
- return;
+ const DeclContext *DC = Record;
+ while (DC) {
+ if (isa<ClassTemplateSpecializationDecl>(DC)) {
+ return;
+ }
+ DC = DC->getParent();
}
AddDecl(Record);
diff --git a/lib/AST/StmtCXX.cpp b/lib/AST/StmtCXX.cpp
index 8466cd61f055..666f5dcc9d97 100644
--- a/lib/AST/StmtCXX.cpp
+++ b/lib/AST/StmtCXX.cpp
@@ -96,6 +96,20 @@ CoroutineBodyStmt *CoroutineBodyStmt::Create(
return new (Mem) CoroutineBodyStmt(Args);
}
+CoroutineBodyStmt *CoroutineBodyStmt::Create(const ASTContext &C, EmptyShell,
+ unsigned NumParams) {
+ std::size_t Size = totalSizeToAlloc<Stmt *>(
+ CoroutineBodyStmt::FirstParamMove + NumParams);
+
+ void *Mem = C.Allocate(Size, alignof(CoroutineBodyStmt));
+ auto *Result = new (Mem) CoroutineBodyStmt(CtorArgs());
+ Result->NumParams = NumParams;
+ auto *ParamBegin = Result->getStoredStmts() + SubStmt::FirstParamMove;
+ std::uninitialized_fill(ParamBegin, ParamBegin + NumParams,
+ static_cast<Stmt *>(nullptr));
+ return Result;
+}
+
CoroutineBodyStmt::CoroutineBodyStmt(CoroutineBodyStmt::CtorArgs const &Args)
: Stmt(CoroutineBodyStmtClass), NumParams(Args.ParamMoves.size()) {
Stmt **SubStmts = getStoredStmts();