Skip to content

Commit

Permalink
Add 4 digit uid to dump file names (#4509)
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Dodd <cdodd@nvidia.com>
  • Loading branch information
ChrisDodd and ChrisDodd committed Mar 13, 2024
1 parent d5129a4 commit 12b08da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion frontends/common/parser_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,9 @@ void ParserOptions::dumpPass(const char *manager, unsigned seq, const char *pass
exit(1);
}
if (match) {
cstring suffix = cstring("-") + name;
char buf[16];
snprintf(buf, sizeof(buf), "-%04zu-", ++dump_uid);
cstring suffix = cstring(buf) + name;
cstring filename = file;
if (filename == "-") filename = "tmp.p4";

Expand Down
3 changes: 3 additions & 0 deletions frontends/common/parser_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class ParserOptions : public Util::Options {
// annotation names that are to be ignored by the compiler
std::set<cstring> disabledAnnotations;

// used to generate dump file names
mutable size_t dump_uid = 0;

protected:
// Function that is returned by getDebugHook.
void dumpPass(const char *manager, unsigned seq, const char *pass, const IR::Node *node) const;
Expand Down

0 comments on commit 12b08da

Please sign in to comment.