@@ -1632,6 +1632,11 @@ class FunctionDecl : public DeclaratorDecl, public DeclContext,
16321632 // / skipped.
16331633 unsigned HasSkippedBody : 1 ;
16341634
1635+ // / Indicates if the function declaration will have a body, once we're done
1636+ // / parsing it. (We don't set it to false when we're done parsing, in the
1637+ // / hopes this is simpler.)
1638+ unsigned WillHaveBody : 1 ;
1639+
16351640 // / \brief End part of this FunctionDecl's source range.
16361641 // /
16371642 // / We could compute the full range in getSourceRange(). However, when we're
@@ -1701,25 +1706,21 @@ class FunctionDecl : public DeclaratorDecl, public DeclContext,
17011706
17021707protected:
17031708 FunctionDecl (Kind DK , ASTContext &C, DeclContext *DC , SourceLocation StartLoc,
1704- const DeclarationNameInfo &NameInfo,
1705- QualType T, TypeSourceInfo *TInfo,
1706- StorageClass S, bool isInlineSpecified,
1709+ const DeclarationNameInfo &NameInfo, QualType T,
1710+ TypeSourceInfo *TInfo, StorageClass S, bool isInlineSpecified,
17071711 bool isConstexprSpecified)
1708- : DeclaratorDecl(DK , DC , NameInfo.getLoc(), NameInfo.getName(), T, TInfo,
1709- StartLoc),
1710- DeclContext (DK ),
1711- redeclarable_base(C),
1712- ParamInfo(nullptr ), Body(),
1713- SClass(S),
1714- IsInline(isInlineSpecified), IsInlineSpecified(isInlineSpecified),
1715- IsVirtualAsWritten(false ), IsPure(false ), HasInheritedPrototype(false ),
1716- HasWrittenPrototype(true ), IsDeleted(false ), IsTrivial(false ),
1717- IsDefaulted(false ), IsExplicitlyDefaulted(false ),
1718- HasImplicitReturnZero(false ), IsLateTemplateParsed(false ),
1719- IsConstexpr(isConstexprSpecified), UsesSEHTry(false ),
1720- HasSkippedBody(false ), EndRangeLoc(NameInfo.getEndLoc()),
1721- TemplateOrSpecialization(),
1722- DNLoc(NameInfo.getInfo()) {}
1712+ : DeclaratorDecl(DK , DC , NameInfo.getLoc(), NameInfo.getName(), T, TInfo,
1713+ StartLoc),
1714+ DeclContext (DK ), redeclarable_base(C), ParamInfo(nullptr ), Body(),
1715+ SClass(S), IsInline(isInlineSpecified),
1716+ IsInlineSpecified(isInlineSpecified), IsVirtualAsWritten(false ),
1717+ IsPure(false ), HasInheritedPrototype(false ), HasWrittenPrototype(true ),
1718+ IsDeleted(false ), IsTrivial(false ), IsDefaulted(false ),
1719+ IsExplicitlyDefaulted(false ), HasImplicitReturnZero(false ),
1720+ IsLateTemplateParsed(false ), IsConstexpr(isConstexprSpecified),
1721+ UsesSEHTry(false ), HasSkippedBody(false ), WillHaveBody(false ),
1722+ EndRangeLoc(NameInfo.getEndLoc()), TemplateOrSpecialization(),
1723+ DNLoc(NameInfo.getInfo()) {}
17231724
17241725 typedef Redeclarable<FunctionDecl> redeclarable_base;
17251726 FunctionDecl *getNextRedeclarationImpl () override {
@@ -2001,6 +2002,10 @@ class FunctionDecl : public DeclaratorDecl, public DeclContext,
20012002 bool hasSkippedBody () const { return HasSkippedBody; }
20022003 void setHasSkippedBody (bool Skipped = true ) { HasSkippedBody = Skipped; }
20032004
2005+ // / True if this function will eventually have a body, once it's fully parsed.
2006+ bool willHaveBody () const { return WillHaveBody; }
2007+ void setWillHaveBody (bool V = true ) { WillHaveBody = V; }
2008+
20042009 void setPreviousDeclaration (FunctionDecl * PrevDecl);
20052010
20062011 FunctionDecl *getCanonicalDecl () override ;
0 commit comments