Permalink
Browse files

Add the rename list stuff to the Use statement.

  • Loading branch information...
1 parent e9cd860 commit db9447dfd9bfc95db185fd2580522884c7b1d186 Bill Wendling committed Oct 23, 2011
Showing with 30 additions and 5 deletions.
  1. +17 −1 include/flang/AST/Stmt.h
  2. +13 −4 lib/AST/Stmt.cpp
View
@@ -149,6 +149,10 @@ class EndProgramStmt : public Stmt {
}
};
+//===----------------------------------------------------------------------===//
+// Specification Part Statements
+//===----------------------------------------------------------------------===//
+
/// UseStmt -
///
class UseStmt : public Stmt {
@@ -162,7 +166,8 @@ class UseStmt : public Stmt {
ModuleNature ModNature;
const IdentifierInfo *ModName;
bool Only;
- // FIXME: Finish...
+ typedef std::pair<const IdentifierInfo *, const IdentifierInfo *> RenamePair;
+ SmallVector<RenamePair, 8> RenameList;
UseStmt(ModuleNature MN, const IdentifierInfo *Info, Token StmtLabelTok);
public:
@@ -173,6 +178,17 @@ class UseStmt : public Stmt {
ModuleNature getModuleNature() const { return ModNature; }
StringRef getModuleName() const;
+ void addRenameItem(const IdentifierInfo *LocalName,
+ const IdentifierInfo *UseName);
+ void addRenameItem(const IdentifierInfo *UseName);
+
+ typedef SmallVectorImpl<RenamePair>::const_iterator iterator;
+
+ iterator begin() const { return RenameList.begin(); }
+ iterator end() const { return RenameList.end(); }
+
+ bool empty() const { return RenameList.empty(); }
+
static bool classof(const UseStmt*) { return true; }
static bool classof(const Stmt *S) {
return S->getStatementID() == Use;
View
@@ -60,16 +60,25 @@ llvm::StringRef UseStmt::getModuleName() const {
return ModName->getName();
}
+void UseStmt::addRenameItem(const IdentifierInfo *LocalName,
+ const IdentifierInfo *UseName) {
+ RenameList.push_back(std::make_pair(LocalName, UseName));
+}
+
+void UseStmt::addRenameItem(const IdentifierInfo *UseName) {
+ RenameList.push_back(std::make_pair(UseName, UseName));
+}
+
//===----------------------------------------------------------------------===//
// Import Statement
//===----------------------------------------------------------------------===//
ImportStmt::ImportStmt(Token StmtLabelTok)
- : Stmt(Import, llvm::SMLoc(), StmtLabelTok) {
+ : Stmt(Import, SMLoc(), StmtLabelTok) {
}
-ImportStmt::ImportStmt(llvm::ArrayRef<const IdentifierInfo*> names,
+ImportStmt::ImportStmt(ArrayRef<const IdentifierInfo*> names,
Token StmtLabelTok)
- : Stmt(Import, llvm::SMLoc(), StmtLabelTok) {
+ : Stmt(Import, SMLoc(), StmtLabelTok) {
Names.resize(names.size());
std::copy(names.begin(), names.end(), Names.begin());
}
@@ -78,7 +87,7 @@ ImportStmt *ImportStmt::Create(Token StmtLabelTok) {
return new ImportStmt(StmtLabelTok);
}
-ImportStmt *ImportStmt::Create(llvm::ArrayRef<const IdentifierInfo*> Names,
+ImportStmt *ImportStmt::Create(ArrayRef<const IdentifierInfo*> Names,
Token StmtLabelTok) {
return new ImportStmt(Names, StmtLabelTok);
}

0 comments on commit db9447d

Please sign in to comment.