================
@@ -125,3 +126,155 @@
CoroutineBodyStmt::CoroutineBodyStmt(CoroutineBodyStmt::CtorArgs const &Args)
Args.ReturnStmtOnAllocFailure;
llvm::copy(Args.ParamMoves, const_cast<Stmt **>(getParamMoves().data()));
}
+
+CXXExpansionStmtPattern::CXXExpansionStmtPattern(StmtClass SC, EmptyShell
Empty)
+ : Stmt(SC, Empty) {}
+
+CXXExpansionStmtPattern::CXXExpansionStmtPattern(
+ StmtClass SC, CXXExpansionStmtDecl *ESD, Stmt *Init, DeclStmt
*ExpansionVar,
+
+ SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation
RParenLoc)
+ : Stmt(SC), ParentDecl(ESD), LParenLoc(LParenLoc), ColonLoc(ColonLoc),
+ RParenLoc(RParenLoc) {
+ setInit(Init);
+ setExpansionVarStmt(ExpansionVar);
+ setBody(nullptr);
+}
+
+CXXEnumeratingExpansionStmtPattern::CXXEnumeratingExpansionStmtPattern(
+ EmptyShell Empty)
+ : CXXExpansionStmtPattern(CXXEnumeratingExpansionStmtPatternClass, Empty)
{}
+
+CXXEnumeratingExpansionStmtPattern::CXXEnumeratingExpansionStmtPattern(
+ CXXExpansionStmtDecl *ESD, Stmt *Init, DeclStmt *ExpansionVar,
+ SourceLocation LParenLoc, SourceLocation ColonLoc, SourceLocation
RParenLoc)
+ : CXXExpansionStmtPattern(CXXEnumeratingExpansionStmtPatternClass, ESD,
+ Init, ExpansionVar, LParenLoc, ColonLoc,
+ RParenLoc) {}
+
+SourceLocation CXXExpansionStmtPattern::getBeginLoc() const {
+ return ParentDecl->getLocation();
+}
+
+VarDecl *CXXExpansionStmtPattern::getExpansionVariable() {
+ Decl *LV = cast<DeclStmt>(getExpansionVarStmt())->getSingleDecl();
+ assert(LV && "No expansion variable in CXXExpansionStmtPattern");
+ return cast<VarDecl>(LV);
+}
+
+bool CXXExpansionStmtPattern::hasDependentSize() const {
+ if (isa<CXXEnumeratingExpansionStmtPattern>(this))
+ return cast<CXXExpansionInitListSelectExpr>(
+ getExpansionVariable()->getInit())
+ ->getRangeExpr()
+ ->containsPackExpansion();
+
+ if (auto *Iterating = dyn_cast<CXXIteratingExpansionStmtPattern>(this)) {
+ const Expr *Begin = Iterating->getBeginVar()->getInit();
+ const Expr *End = Iterating->getBeginVar()->getInit();
+ return Begin->isTypeDependent() || Begin->isValueDependent() ||
----------------
erichkeane wrote:
This is all pretty redundant (If it is Type dependent, it is ALSO value
dependent) :) Also, what is going on? Aren't `Begin` and `End` the same thing
here?
You probably just want `isInstantiationDependent` which covers all dependent
cases.
https://github.com/llvm/llvm-project/pull/169680
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits