[AST][3/4] Move the bit-fields from BlockDecl, LinkageSpecDecl and OMPDeclareReductionDecl into DeclContext
This patch follows https://reviews.llvm.org/D49729
and https://reviews.llvm.org/D49732, and is
followed by https://reviews.llvm.org/D49734.
Move the bits from BlockDecl, LinkageSpecDecl and
OMPDeclareReductionDecl into DeclContext.
Differential Revision: https://reviews.llvm.org/D49733
Patch By: bricci
llvm-svn: 338639
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 0edd18e..e38172d 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -4215,6 +4215,15 @@
// BlockDecl Implementation
//===----------------------------------------------------------------------===//
+BlockDecl::BlockDecl(DeclContext *DC, SourceLocation CaretLoc)
+ : Decl(Block, DC, CaretLoc), DeclContext(Block) {
+ setIsVariadic(false);
+ setCapturesCXXThis(false);
+ setBlockMissingReturnType(true);
+ setIsConversionFromLambda(false);
+ setDoesNotEscape(false);
+}
+
void BlockDecl::setParams(ArrayRef<ParmVarDecl *> NewParamInfo) {
assert(!ParamInfo && "Already has param info!");
@@ -4228,7 +4237,7 @@
void BlockDecl::setCaptures(ASTContext &Context, ArrayRef<Capture> Captures,
bool CapturesCXXThis) {
- this->CapturesCXXThis = CapturesCXXThis;
+ this->setCapturesCXXThis(CapturesCXXThis);
this->NumCaptures = Captures.size();
if (Captures.empty()) {
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 8fe27f1..c43bdfb 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -2466,6 +2466,15 @@
getConversionType()->isBlockPointerType();
}
+LinkageSpecDecl::LinkageSpecDecl(DeclContext *DC, SourceLocation ExternLoc,
+ SourceLocation LangLoc, LanguageIDs lang,
+ bool HasBraces)
+ : Decl(LinkageSpec, DC, LangLoc), DeclContext(LinkageSpec),
+ ExternLoc(ExternLoc), RBraceLoc(SourceLocation()) {
+ setLanguage(lang);
+ LinkageSpecDeclBits.HasBraces = HasBraces;
+}
+
void LinkageSpecDecl::anchor() {}
LinkageSpecDecl *LinkageSpecDecl::Create(ASTContext &C,
diff --git a/clang/lib/AST/DeclOpenMP.cpp b/clang/lib/AST/DeclOpenMP.cpp
index f5c3599..eaf88de 100644
--- a/clang/lib/AST/DeclOpenMP.cpp
+++ b/clang/lib/AST/DeclOpenMP.cpp
@@ -57,6 +57,14 @@
// OMPDeclareReductionDecl Implementation.
//===----------------------------------------------------------------------===//
+OMPDeclareReductionDecl::OMPDeclareReductionDecl(
+ Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name,
+ QualType Ty, OMPDeclareReductionDecl *PrevDeclInScope)
+ : ValueDecl(DK, DC, L, Name, Ty), DeclContext(DK), Combiner(nullptr),
+ PrevDeclInScope(PrevDeclInScope) {
+ setInitializer(nullptr, CallInit);
+}
+
void OMPDeclareReductionDecl::anchor() {}
OMPDeclareReductionDecl *OMPDeclareReductionDecl::Create(