task-create-implicit-pass #30
@@ -16,6 +16,7 @@ using std::string;
|
||||
using std::to_string;
|
||||
|
||||
map<char, SgType*> types;
|
||||
vector<SgSymbol*> allVars;
|
||||
vector<SgSymbol*> varsWithoutDecl;
|
||||
const char commonIntLetters[6] = {'i', 'j', 'k', 'm', 'n', 'l'};
|
||||
|
||||
@@ -23,15 +24,6 @@ void InitTypes();
|
||||
void FillCommonTypes();
|
||||
void GetImplicitTypes(SgExpression* expr);
|
||||
|
||||
static inline string getContains(SgStatement* funcSt)
|
||||
{
|
||||
string containsName;
|
||||
SgStatement* st_cp = funcSt->controlParent();
|
||||
if (st_cp->variant() == PROC_HEDR || st_cp->variant() == PROG_HEDR || st_cp->variant() == FUNC_HEDR)
|
||||
containsName = st_cp->symbol()->identifier() + std::string(".");
|
||||
return containsName;
|
||||
}
|
||||
|
||||
void ImplicitCheck(SgFile* file) {
|
||||
|
||||
auto implicitNoneDeclaration = new SgStatement(IMPL_DECL);
|
||||
@@ -49,6 +41,7 @@ void ImplicitCheck(SgFile* file) {
|
||||
SgType* type = implicitSt->implicitType(j);
|
||||
SgExpression* letters = implicitSt->implicitRangeList(j);
|
||||
|
||||
// get real letters
|
||||
types['a'] = type;
|
||||
printf("%s\n", letters->unparse());
|
||||
}
|
||||
@@ -63,6 +56,18 @@ void ImplicitCheck(SgFile* file) {
|
||||
}
|
||||
}
|
||||
|
||||
// get all vars
|
||||
|
||||
for each (auto var in allVars)
|
||||
{
|
||||
SgStatement* declaredIn = declaratedInStmt(var);
|
||||
if (declaredIn == NULL) {
|
||||
varsWithoutDecl.push_back(var);
|
||||
}
|
||||
}
|
||||
|
||||
// create decl
|
||||
// delete implicit
|
||||
|
||||
if (!hasImplicitNone) {
|
||||
auto firstRealStatementOfFile = file->firstStatement()->lexNext()->lexNext();
|
||||
|
||||
Reference in New Issue
Block a user