summaryrefslogtreecommitdiff
path: root/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorarphaman <arphaman@gmail.com>2013-08-05 12:58:18 +0100
committerarphaman <arphaman@gmail.com>2013-08-05 12:58:18 +0100
commit7bf3255ea110256fd05fdc9ece7cc72ca2316e04 (patch)
tree6bf65d77f3fe181204e788c6a5b03b04e44af1b6 /lib/Sema/Sema.cpp
parentf4aa3fa33d6668057bcd3795eb9998b2f2ebc518 (diff)
downloadflang-7bf3255ea110256fd05fdc9ece7cc72ca2316e04.tar.gz
added parsing and sema for the SAVE stmt; improved spec diagnostics
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r--lib/Sema/Sema.cpp29
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index bf18d61719..2acbc70faf 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -37,6 +37,11 @@ Sema::Sema(ASTContext &ctxt, DiagnosticsEngine &D)
Sema::~Sema() {}
+// FIXME
+SourceRange Sema::getIdentifierRange(SourceLocation Loc, const IdentifierInfo *IDInfo) {
+ return SourceRange(Loc, SourceLocation::getFromPointer(Loc.getPointer()+IDInfo->getLength()));
+}
+
// getContainingDC - Determines the context to return to after temporarily
// entering a context. This depends in an unnecessarily complicated way on the
// exact ordering of callbacks from the parser.
@@ -660,15 +665,6 @@ VarDecl *Sema::ExpectVarRef(SourceLocation IDLoc,
StmtResult Sema::ActOnCompoundStmt(ASTContext &C, SourceLocation Loc,
ArrayRef<Stmt*> Body, Expr *StmtLabel) {
- if(Body.size() == 1) {
- auto Result = Body[0];
- if(StmtLabel) {
- DeclareStatementLabel(StmtLabel, Result);
- Result->setLocation(Loc);
- Result->setStmtLabel(StmtLabel);
- }
- return Result;
- }
auto Result = CompoundStmt::Create(C, Loc, Body, StmtLabel);
if(StmtLabel) DeclareStatementLabel(StmtLabel, Result);
return Result;
@@ -885,6 +881,21 @@ StmtResult Sema::ActOnINTRINSIC(ASTContext &C, SourceLocation Loc,
return Result;
}
+StmtResult Sema::ActOnSAVE(ASTContext &C, SourceLocation Loc, Expr *StmtLabel) {
+ auto Result = SaveStmt::Create(C, Loc, nullptr, StmtLabel);
+ if(StmtLabel) DeclareStatementLabel(StmtLabel, Result);
+ return Result;
+}
+
+StmtResult Sema::ActOnSAVE(ASTContext &C, SourceLocation Loc,
+ SourceLocation IDLoc,
+ const IdentifierInfo *IDInfo,
+ Expr *StmtLabel) {
+ auto Result = SaveStmt::Create(C, IDLoc, IDInfo, StmtLabel);
+ if(StmtLabel) DeclareStatementLabel(StmtLabel, Result);
+ return Result;
+}
+
/// FIXME: allow outer scope integer constants.
/// FIXME: walk constant expressions like 1+1.
ExprResult Sema::ActOnDATAOuterImpliedDoExpr(ASTContext &C,