Skip to content

Commit

Permalink
Change over the IMPORT statement to use the LIstStmt class.
Browse files Browse the repository at this point in the history
  • Loading branch information
Bill Wendling committed Nov 18, 2011
1 parent 9a43914 commit f92ee4a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
9 changes: 1 addition & 8 deletions include/flang/AST/Stmt.h
Expand Up @@ -224,21 +224,14 @@ class UseStmt : public Stmt {
/// ImportStmt - Specifies that the named entities from the host scoping unit
/// are accessible in the interface body by host association.
///
class ImportStmt : public Stmt {
unsigned NumNames;
const IdentifierInfo **Names;

class ImportStmt : public ListStmt {
ImportStmt(ASTContext &C, SMLoc Loc, ArrayRef<const IdentifierInfo*> names,
ExprResult StmtLabel);
public:
static ImportStmt *Create(ASTContext &C, SMLoc Loc,
ArrayRef<const IdentifierInfo*> Names,
ExprResult StmtLabel);

ArrayRef<const IdentifierInfo *> getNameList() const {
return ArrayRef<const IdentifierInfo *>(Names, NumNames);
}

static bool classof(const ImportStmt*) { return true; }
static bool classof(const Stmt *S) {
return S->getStatementID() == Import;
Expand Down
9 changes: 2 additions & 7 deletions lib/AST/Stmt.cpp
Expand Up @@ -101,14 +101,9 @@ llvm::StringRef UseStmt::getModuleName() const {
//===----------------------------------------------------------------------===//

ImportStmt::ImportStmt(ASTContext &C, SMLoc Loc,
ArrayRef<const IdentifierInfo*> names,
ArrayRef<const IdentifierInfo*> Names,
ExprResult StmtLabel)
: Stmt(Import, Loc, StmtLabel), NumNames(names.size()), Names(0) {
Names = new (C) const IdentifierInfo*[NumNames];

for (unsigned I = 0; I != NumNames; ++I)
Names[I] = names[I];
}
: ListStmt(C, Import, Loc, Names, StmtLabel) {}

ImportStmt *ImportStmt::Create(ASTContext &C, SMLoc Loc,
ArrayRef<const IdentifierInfo*> Names,
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/StmtDumper.cpp
Expand Up @@ -75,7 +75,7 @@ void StmtVisitor::visit(const EndProgramStmt *S) {
void StmtVisitor::visit(const UseStmt *S) {
}
void StmtVisitor::visit(const ImportStmt *S) {
ArrayRef<const IdentifierInfo *> NameList = S->getNameList();
ArrayRef<const IdentifierInfo *> NameList = S->getIDList();
OS << "(import";
if (NameList.size() != 0) {
OS << ":";
Expand Down

0 comments on commit f92ee4a

Please sign in to comment.