Skip to content

Commit

Permalink
[Support] Allow erasing names in Namespace
Browse files Browse the repository at this point in the history
Allowing erasing names in a namespace seems more sane than micro-managing which names gets added to a namespace. E.g., it's convenient to use `Namespace::add(SymbolCache &` to efficiently prime a namespace, and then surgically removing some known identifier,, instead of having to re-implement how symbols are added to the namespace.
  • Loading branch information
Morten Borup Petersen committed Aug 2, 2024
1 parent 20cb546 commit 735a1c3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/circt/Support/Namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ class Namespace {
nextIndex.insert({strAttr.getValue(), 0});
}

/// Removes a symbol from the namespace. Returns true if the symbol was
/// removed, false if the symbol was not found.
bool erase(llvm::StringRef symbol) { return nextIndex.erase(symbol); }

/// Empty the namespace.
void clear() { nextIndex.clear(); }

Expand Down

0 comments on commit 735a1c3

Please sign in to comment.