Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use the ASTContext when creating the statements. Also add a default I…

…mplicitStmt.
  • Loading branch information...
commit 033c3cbb4e53ca17f261971fdfa190f74ae8a036 1 parent db9447d
Bill Wendling authored
Showing with 47 additions and 12 deletions.
  1. +25 −4 include/flang/AST/Stmt.h
  2. +22 −8 lib/AST/Stmt.cpp
View
29 include/flang/AST/Stmt.h
@@ -34,6 +34,7 @@ class Stmt {
Program,
Use,
Import,
+ Implicit,
Asynchronous,
EndProgram,
Assignment,
@@ -171,7 +172,8 @@ class UseStmt : public Stmt {
UseStmt(ModuleNature MN, const IdentifierInfo *Info, Token StmtLabelTok);
public:
- static UseStmt *Create(ModuleNature MN, const IdentifierInfo *Info,
+ static UseStmt *Create(ASTContext &C, ModuleNature MN,
+ const IdentifierInfo *Info,
Token StmtLabelTok);
/// Accessors:
@@ -205,8 +207,9 @@ class ImportStmt : public Stmt {
ImportStmt(ArrayRef<const IdentifierInfo*> names, Token StmtLabelTok);
ImportStmt(const ImportStmt &); // Do not implement!
public:
- static ImportStmt *Create(Token StmtLabelTok);
- static ImportStmt *Create(ArrayRef<const IdentifierInfo*> Names,
+ static ImportStmt *Create(ASTContext &C, Token StmtLabelTok);
+ static ImportStmt *Create(ASTContext &C,
+ ArrayRef<const IdentifierInfo*> Names,
Token StmtLabelTok);
unsigned getNumNames() const { return Names.size(); }
@@ -223,6 +226,23 @@ class ImportStmt : public Stmt {
}
};
+/// ImplicitStmt - Specifies a type, and possibly type parameters, for all
+/// implicitly typed data entries whose names begin with one of the letters
+/// specified in the statement.
+///
+class ImplicitStmt : public Stmt {
+ bool None;
+
+ ImplicitStmt(SMLoc L, Token StmtLabel);
+public:
+ static ImplicitStmt *Create(ASTContext &C, SMLoc L, Token StmtLabel);
+
+ static bool classof(const ImplicitStmt*) { return true; }
+ static bool classof(const Stmt *S) {
+ return S->getStatementID() == Implicit;
+ }
+};
+
/// AsynchronousStmt - Specifies the asynchronous attribute for a list of
/// objects.
///
@@ -231,7 +251,8 @@ class AsynchronousStmt : public Stmt {
AsynchronousStmt(ArrayRef<const IdentifierInfo*> objNames,
Token StmtLabelTok);
public:
- static AsynchronousStmt*Create(ArrayRef<const IdentifierInfo*> objNames,
+ static AsynchronousStmt *Create(ASTContext &C,
+ ArrayRef<const IdentifierInfo*> objNames,
Token StmtLabelTok);
static bool classof(const AsynchronousStmt*) { return true; }
View
30 lib/AST/Stmt.cpp
@@ -51,9 +51,10 @@ EndProgramStmt *EndProgramStmt::Create(ASTContext &C,
UseStmt::UseStmt(ModuleNature MN, const IdentifierInfo *Info,Token StmtLabelTok)
: Stmt(Use, llvm::SMLoc(), StmtLabelTok), ModNature(MN), ModName(Info) {}
-UseStmt *UseStmt::Create(ModuleNature MN, const IdentifierInfo *Info,
+UseStmt *UseStmt::Create(ASTContext &C, ModuleNature MN,
+ const IdentifierInfo *Info,
Token StmtLabelTok) {
- return new UseStmt(MN, Info, StmtLabelTok);
+ return new (C) UseStmt(MN, Info, StmtLabelTok);
}
llvm::StringRef UseStmt::getModuleName() const {
@@ -83,13 +84,25 @@ ImportStmt::ImportStmt(ArrayRef<const IdentifierInfo*> names,
std::copy(names.begin(), names.end(), Names.begin());
}
-ImportStmt *ImportStmt::Create(Token StmtLabelTok) {
- return new ImportStmt(StmtLabelTok);
+ImportStmt *ImportStmt::Create(ASTContext &C, Token StmtLabelTok) {
+ return new (C) ImportStmt(StmtLabelTok);
}
-ImportStmt *ImportStmt::Create(ArrayRef<const IdentifierInfo*> Names,
+ImportStmt *ImportStmt::Create(ASTContext &C,
+ ArrayRef<const IdentifierInfo*> Names,
Token StmtLabelTok) {
- return new ImportStmt(Names, StmtLabelTok);
+ return new (C) ImportStmt(Names, StmtLabelTok);
+}
+
+//===----------------------------------------------------------------------===//
+// Implicit Statement
+//===----------------------------------------------------------------------===//
+
+ImplicitStmt::ImplicitStmt(SMLoc L, Token StmtLabel)
+ : Stmt(Implicit, L, StmtLabel), None(true) {}
+
+ImplicitStmt *ImplicitStmt::Create(ASTContext &C, SMLoc L, Token StmtLabel) {
+ return new (C) ImplicitStmt(L, StmtLabel);
}
//===----------------------------------------------------------------------===//
@@ -104,8 +117,9 @@ AsynchronousStmt(llvm::ArrayRef<const IdentifierInfo*> objNames,
}
AsynchronousStmt *AsynchronousStmt::
-Create(llvm::ArrayRef<const IdentifierInfo*> objNames, Token StmtLabelTok) {
- return new AsynchronousStmt(objNames, StmtLabelTok);
+Create(ASTContext &C, llvm::ArrayRef<const IdentifierInfo*> objNames,
+ Token StmtLabelTok) {
+ return new (C) AsynchronousStmt(objNames, StmtLabelTok);
}
//===----------------------------------------------------------------------===//
Please sign in to comment.
Something went wrong with that request. Please try again.