Skip to content

Commit 978d362

Browse files
authored
fix compile error for newer VS toolchain (microsoft#6648)
This is to fix compile error like ``` ../../third_party/dxc/utils/TableGen/AsmWriterEmitter.cpp(974): error C2666: '`anonymous-namespace'::IAPrinter::operator ==': overloaded functions have similar conversions ../../third_party/dxc/utils/TableGen/AsmWriterEmitter.cpp(739): note: could be 'bool `anonymous-namespace'::IAPrinter::operator ==(const `anonymous-namespace'::IAPrinter &)' ../../third_party/dxc/utils/TableGen/AsmWriterEmitter.cpp(739): note: or 'bool `anonymous-namespace'::IAPrinter::operator ==(const `anonymous-namespace'::IAPrinter &)' [synthesized expression 'y == x'] ../../third_party/dxc/utils/TableGen/AsmWriterEmitter.cpp(974): note: while trying to match the argument list '(`anonymous-namespace'::IAPrinter, `anonymous-namespace'::IAPrinter)' ``` in dawn project which is updating to newer VS toolchain. This imports fix from llvm/llvm-project@4ab57cd. more context is in https://issues.chromium.org/issues/341890053#comment2
1 parent 3a78b67 commit 978d362

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

utils/TableGen/AsmWriterEmitter.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -736,14 +736,13 @@ class IAPrinter {
736736
O.indent(4) << '}';
737737
}
738738

739-
bool operator==(const IAPrinter &RHS) {
739+
bool operator==(const IAPrinter &RHS) const {
740740
if (Conds.size() != RHS.Conds.size())
741741
return false;
742742

743743
unsigned Idx = 0;
744-
for (std::vector<std::string>::iterator
745-
I = Conds.begin(), E = Conds.end(); I != E; ++I)
746-
if (*I != RHS.Conds[Idx++])
744+
for (const auto &str : Conds)
745+
if (str != RHS.Conds[Idx++])
747746
return false;
748747

749748
return true;
@@ -1073,7 +1072,7 @@ void AsmWriterEmitter::EmitPrintAliasInstruction(raw_ostream &O) {
10731072
<< " break;\n";
10741073
}
10751074
O << " }\n";
1076-
}
1075+
}
10771076
O << "}\n\n";
10781077

10791078
if (!MCOpPredicates.empty()) {

0 commit comments

Comments
 (0)