diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-06-23 19:16:49 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-06-23 19:16:49 +0000 |
| commit | b130fe7d316efb01870e99912d58ea7c5a11a329 (patch) | |
| tree | 4c4b0d9f45a07ef00c65f01b8a375ab693c7be77 /clang/lib/AST | |
| parent | fe1397b97716de33571563c6e7b3bdf2d7a28148 (diff) | |
| download | bcm5719-llvm-b130fe7d316efb01870e99912d58ea7c5a11a329.tar.gz bcm5719-llvm-b130fe7d316efb01870e99912d58ea7c5a11a329.zip | |
Implement p0292r2 (constexpr if), a likely C++1z feature.
llvm-svn: 273602
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/ASTImporter.cpp | 3 | ||||
| -rw-r--r-- | clang/lib/AST/Stmt.cpp | 9 |
2 files changed, 7 insertions, 5 deletions
diff --git a/clang/lib/AST/ASTImporter.cpp b/clang/lib/AST/ASTImporter.cpp index a70b38fc902..9a4e4a2894d 100644 --- a/clang/lib/AST/ASTImporter.cpp +++ b/clang/lib/AST/ASTImporter.cpp @@ -4981,7 +4981,8 @@ Stmt *ASTNodeImporter::VisitIfStmt(IfStmt *S) { if (!ToElseStmt && S->getElse()) return nullptr; return new (Importer.getToContext()) IfStmt(Importer.getToContext(), - ToIfLoc, ToConditionVariable, + ToIfLoc, S->isConstexpr(), + ToConditionVariable, ToCondition, ToThenStmt, ToElseLoc, ToElseStmt); } diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index f514ed21f47..5f1adf7a20f 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -763,10 +763,11 @@ void MSAsmStmt::initialize(const ASTContext &C, StringRef asmstr, }); } -IfStmt::IfStmt(const ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond, - Stmt *then, SourceLocation EL, Stmt *elsev) - : Stmt(IfStmtClass), IfLoc(IL), ElseLoc(EL) -{ +IfStmt::IfStmt(const ASTContext &C, SourceLocation IL, bool IsConstexpr, + VarDecl *var, Expr *cond, Stmt *then, SourceLocation EL, + Stmt *elsev) + : Stmt(IfStmtClass), IfLoc(IL), ElseLoc(EL) { + setConstexpr(IsConstexpr); setConditionVariable(C, var); SubExprs[COND] = cond; SubExprs[THEN] = then; |

