[PATCH] D26105: Allow CaseStmt to be initialized with a SubStmt
Kareem Khazem via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 28 16:24:44 PDT 2016
khazem updated this revision to Diff 76272.
khazem added a comment.
(added more context)
https://reviews.llvm.org/D26105
Files:
include/clang/AST/Stmt.h
lib/AST/ASTImporter.cpp
Index: lib/AST/ASTImporter.cpp
===================================================================
--- lib/AST/ASTImporter.cpp
+++ lib/AST/ASTImporter.cpp
@@ -5102,12 +5102,15 @@
Expr *ToRHS = Importer.Import(S->getRHS());
if (!ToRHS && S->getRHS())
return nullptr;
+ Stmt *SubStmt = Importer.Import(S->getSubStmt());
+ if (!SubStmt && S->getSubStmt())
+ return nullptr;
SourceLocation ToCaseLoc = Importer.Import(S->getCaseLoc());
SourceLocation ToEllipsisLoc = Importer.Import(S->getEllipsisLoc());
SourceLocation ToColonLoc = Importer.Import(S->getColonLoc());
- return new (Importer.getToContext()) CaseStmt(ToLHS, ToRHS,
- ToCaseLoc, ToEllipsisLoc,
- ToColonLoc);
+ return new (Importer.getToContext()) CaseStmt(ToLHS, ToRHS, ToCaseLoc,
+ ToEllipsisLoc, ToColonLoc,
+ SubStmt);
}
Stmt *ASTNodeImporter::VisitDefaultStmt(DefaultStmt *S) {
Index: include/clang/AST/Stmt.h
===================================================================
--- include/clang/AST/Stmt.h
+++ include/clang/AST/Stmt.h
@@ -693,9 +693,10 @@
// GNU "case 1 ... 4" extension
public:
CaseStmt(Expr *lhs, Expr *rhs, SourceLocation caseLoc,
- SourceLocation ellipsisLoc, SourceLocation colonLoc)
+ SourceLocation ellipsisLoc, SourceLocation colonLoc,
+ Stmt *SubStmt=nullptr)
: SwitchCase(CaseStmtClass, caseLoc, colonLoc) {
- SubExprs[SUBSTMT] = nullptr;
+ SubExprs[SUBSTMT] = SubStmt;
SubExprs[LHS] = reinterpret_cast<Stmt*>(lhs);
SubExprs[RHS] = reinterpret_cast<Stmt*>(rhs);
EllipsisLoc = ellipsisLoc;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26105.76272.patch
Type: text/x-patch
Size: 1791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161028/b924b0c9/attachment.bin>
More information about the cfe-commits
mailing list