Add comments

This commit is contained in:
2024-03-12 11:24:52 +03:00
parent 02de4e83ff
commit cf2bed5c9c

View File

@@ -16,6 +16,7 @@ using std::string;
using std::to_string; using std::to_string;
map<char, SgType*> types; map<char, SgType*> types;
vector<SgSymbol*> allVars;
vector<SgSymbol*> varsWithoutDecl; vector<SgSymbol*> varsWithoutDecl;
const char commonIntLetters[6] = {'i', 'j', 'k', 'm', 'n', 'l'}; const char commonIntLetters[6] = {'i', 'j', 'k', 'm', 'n', 'l'};
@@ -23,15 +24,6 @@ void InitTypes();
void FillCommonTypes(); void FillCommonTypes();
void GetImplicitTypes(SgExpression* expr); 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) { void ImplicitCheck(SgFile* file) {
auto implicitNoneDeclaration = new SgStatement(IMPL_DECL); auto implicitNoneDeclaration = new SgStatement(IMPL_DECL);
@@ -49,6 +41,7 @@ void ImplicitCheck(SgFile* file) {
SgType* type = implicitSt->implicitType(j); SgType* type = implicitSt->implicitType(j);
SgExpression* letters = implicitSt->implicitRangeList(j); SgExpression* letters = implicitSt->implicitRangeList(j);
// get real letters
types['a'] = type; types['a'] = type;
printf("%s\n", letters->unparse()); 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) { if (!hasImplicitNone) {
auto firstRealStatementOfFile = file->firstStatement()->lexNext()->lexNext(); auto firstRealStatementOfFile = file->firstStatement()->lexNext()->lexNext();