#pragma once

std::string correctSymbolModuleName(const std::string& origFull);
const std::set<SgSymbol*>& getModuleSymbols(SgStatement* func);
void getModulesAndFunctions(SgFile* file, std::vector<SgStatement*>& modulesAndFunctions);
void findModulesInFile(SgFile* file, std::vector<SgStatement*>& modules);
std::map<std::string, std::set<std::string>> createMapOfModuleUses(SgFile* file);
void fillModuleUse(SgFile* file, std::map<std::string, std::set<std::string>>& moduleUses, std::map<std::string, std::string>& moduleDecls);
void filterModuleUse(std::map<std::string, std::set<std::string>>& moduleUses, std::map<std::string, std::string>& moduleDecls);
SgSymbol* getNameInLocation(SgStatement* func, const std::string& varName, const std::string& locName);
SgSymbol* getNameInLocation(SgSymbol* curr, SgStatement* location);
void fillUsedModulesInFunction(SgStatement* st, std::vector<SgStatement*>& useStats);
void fillUseStatement(SgStatement* st, std::set<std::string>& useMod, std::map<std::string, std::vector<std::pair<SgSymbol*, SgSymbol*>>>& modByUse, std::map<std::string, std::vector<std::pair<SgSymbol*, SgSymbol*>>>& modByUseOnly);
void fixUseOnlyStmt(SgFile* file, const std::vector<ParallelRegion*>& regs);
std::map<std::string, std::set<SgSymbol*>> moduleRefsByUseInFunction(SgStatement* stIn);
