Skip to content

Commit

Permalink
Fix generateFileName
Browse files Browse the repository at this point in the history
Signed-off-by: Anna Rift <[email protected]>
  • Loading branch information
riftEmber committed Dec 9, 2024
1 parent fb982cb commit 79bf956
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions compiler/codegen/codegen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2275,19 +2275,19 @@ static const char* generateFileName(ChainHashMap<const char*, StringHashFns, int
// filename we haven't seen before
std::string filename = lowerFilename;
int version = 1;
while (filenames.get(filename.c_str())) {
while (filenames.get(astr(filename))) {
version++;
filename = lowerFilename + std::to_string(version);
}
filenames.put(filename.c_str(), 1);
filenames.put(astr(filename), 1);

// build the real filename using that version number -- preserves
// case by default by going back to currentModule->name rather
// than using the lowercase filename
if (version == 1) {
filename = currentModuleName;
} else {
filename = currentModuleName + version;
filename = currentModuleName + std::to_string(version);
}

name = astr(filename);
Expand Down

0 comments on commit 79bf956

Please sign in to comment.