diff options
author | Erich Keane <erich.keane@intel.com> | 2018-08-01 21:02:40 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2018-08-01 21:02:40 +0000 |
commit | 9c66506604c7868c6e476df8410b8fcfe98ad975 (patch) | |
tree | 30e36fab08ddcc6b37240108e57ffca24d9bca47 /clang/lib/AST/Decl.cpp | |
parent | 175ef5f29e0e2c01f2f876174826b0a9f3d5103f (diff) | |
download | bcm5719-llvm-9c66506604c7868c6e476df8410b8fcfe98ad975.tar.gz bcm5719-llvm-9c66506604c7868c6e476df8410b8fcfe98ad975.zip |
[AST][2/4] Move the bit-fields from FunctionDecl and CXXConstructorDecl into DeclContext
This patch follows https://reviews.llvm.org/D49729
and is followed by https://reviews.llvm.org/D49733
and https://reviews.llvm.org/D49734.
Move the bits from FunctionDecl and CXXConstructorDecl
into DeclContext.
Differential Revision: https://reviews.llvm.org/D49732
Patch By: bricci
llvm-svn: 338636
Diffstat (limited to 'clang/lib/AST/Decl.cpp')
-rw-r--r-- | clang/lib/AST/Decl.cpp | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index fe8285c444b..0edd18e3931 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -2609,6 +2609,38 @@ unsigned ParmVarDecl::getParameterIndexLarge() const { // FunctionDecl Implementation //===----------------------------------------------------------------------===// +FunctionDecl::FunctionDecl(Kind DK, ASTContext &C, DeclContext *DC, + SourceLocation StartLoc, + const DeclarationNameInfo &NameInfo, QualType T, + TypeSourceInfo *TInfo, StorageClass S, + bool isInlineSpecified, bool isConstexprSpecified) + : DeclaratorDecl(DK, DC, NameInfo.getLoc(), NameInfo.getName(), T, TInfo, + StartLoc), + DeclContext(DK), redeclarable_base(C), ODRHash(0), + EndRangeLoc(NameInfo.getEndLoc()), DNLoc(NameInfo.getInfo()) { + setStorageClass(S); + setInlineSpecified(isInlineSpecified); + setExplicitSpecified(false); + setVirtualAsWritten(false); + setPure(false); + setHasInheritedPrototype(false); + setHasWrittenPrototype(true); + setDeletedAsWritten(false); + setTrivial(false); + setTrivialForCall(false); + setDefaulted(false); + setExplicitlyDefaulted(false); + setHasImplicitReturnZero(false); + setLateTemplateParsed(false); + setConstexpr(isConstexprSpecified); + setInstantiationIsPending(false); + setUsesSEHTry(false); + setHasSkippedBody(false); + setWillHaveBody(false); + setIsMultiVersion(false); + setHasODRHash(false); +} + void FunctionDecl::getNameForDiagnostic( raw_ostream &OS, const PrintingPolicy &Policy, bool Qualified) const { NamedDecl::getNameForDiagnostic(OS, Policy, Qualified); @@ -2676,7 +2708,7 @@ void FunctionDecl::setBody(Stmt *B) { } void FunctionDecl::setPure(bool P) { - IsPure = P; + FunctionDeclBits.IsPure = P; if (P) if (auto *Parent = dyn_cast<CXXRecordDecl>(getDeclContext())) Parent->markedVirtualFunctionPure(); @@ -2892,8 +2924,8 @@ FunctionDecl::setPreviousDeclaration(FunctionDecl *PrevDecl) { FunTmpl->setPreviousDecl(PrevFunTmpl); } - if (PrevDecl && PrevDecl->IsInline) - IsInline = true; + if (PrevDecl && PrevDecl->isInlined()) + setImplicitlyInline(true); } FunctionDecl *FunctionDecl::getCanonicalDecl() { return getFirstDecl(); } @@ -3664,23 +3696,23 @@ unsigned FunctionDecl::getMemoryFunctionKind() const { } unsigned FunctionDecl::getODRHash() const { - assert(HasODRHash); + assert(hasODRHash()); return ODRHash; } unsigned FunctionDecl::getODRHash() { - if (HasODRHash) + if (hasODRHash()) return ODRHash; if (auto *FT = getInstantiatedFromMemberFunction()) { - HasODRHash = true; + setHasODRHash(true); ODRHash = FT->getODRHash(); return ODRHash; } class ODRHash Hash; Hash.AddFunctionDecl(this); - HasODRHash = true; + setHasODRHash(true); ODRHash = Hash.CalculateHash(); return ODRHash; } @@ -4350,7 +4382,7 @@ FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC, FunctionDecl *New = new (C, DC) FunctionDecl(Function, C, DC, StartLoc, NameInfo, T, TInfo, SC, isInlineSpecified, isConstexprSpecified); - New->HasWrittenPrototype = hasWrittenPrototype; + New->setHasWrittenPrototype(hasWrittenPrototype); return New; } |