mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 17:38:14 +00:00
Remove default constructor from IndexBase (#2598)
There were some notes about default constructors being required in parse_tree.h, but they don't seem to be. Removing the default constructor forces the explicit `::Invalid` where there's no value immediately being assigned, which works fine for existing code. I think this actually reduces the chance of accidents more than the prior default-construct-as-invalid approach.
This commit is contained in:
1 parent
aa307b1144
commit
b76bc875c4
7 files changed
+28
-30
No files matched your search
@@ -124,7 +124,7 @@ auto ParseTree::Print(llvm::raw_ostream& output) const -> void {
|
||||
}
|
||||
|
||||
while (!node_stack.empty()) {
|
||||
Node n;
|
||||
Node n = Node::Invalid;
|
||||
int depth;
|
||||
std::tie(n, depth) = node_stack.pop_back_val();
|
||||
for (Node sibling_n : children(n)) {
|
||||
@@ -161,7 +161,7 @@ auto ParseTree::Print(llvm::raw_ostream& output, bool preorder) const -> void {
|
||||
}
|
||||
|
||||
while (!node_stack.empty()) {
|
||||
Node n;
|
||||
Node n = Node::Invalid;
|
||||
int depth;
|
||||
std::tie(n, depth) = node_stack.pop_back_val();
|
||||
|
||||
|
||||
Reference in new issue
Block a user