Skip to content

Commit

Permalink
cc: remove preprocessed file after generating AST
Browse files Browse the repository at this point in the history
  • Loading branch information
atirut-w committed Aug 14, 2024
1 parent d4c22e6 commit 35e389e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/cc/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ int main(int argc, char *argv[])
CommonTokenStream tokens(&lexer);
CParser parser(&tokens);

if (!keep_intermediate)
{
filesystem::remove(intermediate.replace_extension(".i"));
}

tree::ParseTree *tree = parser.compilationUnit();
if (lexer.getNumberOfSyntaxErrors() > 0 || parser.getNumberOfSyntaxErrors() > 0)
{
Expand All @@ -94,10 +99,6 @@ int main(int argc, char *argv[])
return 0;
}

if (!keep_intermediate)
{
filesystem::remove(intermediate.replace_extension(".i"));
}
std::ofstream output(intermediate.replace_extension(".s"));

Analyzer analyzer;
Expand Down

0 comments on commit 35e389e

Please sign in to comment.