Any chance this can/should be unit tested? (also, in general (though might not matter in this instance), symmetric operators like == should be implemented as non-members (though they can still be friends and if they are, can be defined inline in the class definition as a member could be), so any implicit conversions apply equally to the LHS as the RHS of the expression)
On Thu, Jul 12, 2018 at 1:48 PM Simon Marchi via Phabricator via cfe-commits <cfe-commits@lists.llvm.org> wrote: > simark created this revision. > Herald added subscribers: cfe-commits, ioeric, ilya-biryukov. > > It does the obvious thing of comparing all fields. This will be needed > for a clangd patch I have in the pipeline. > > > Repository: > rC Clang > > https://reviews.llvm.org/D49265 > > Files: > include/clang/Tooling/CompilationDatabase.h > > > Index: include/clang/Tooling/CompilationDatabase.h > =================================================================== > --- include/clang/Tooling/CompilationDatabase.h > +++ include/clang/Tooling/CompilationDatabase.h > @@ -59,6 +59,11 @@ > > /// The output file associated with the command. > std::string Output; > + > + bool operator==(const CompileCommand &RHS) const { > + return Directory == RHS.Directory && Filename == RHS.Filename && > + CommandLine == RHS.CommandLine && Output == RHS.Output; > + } > }; > > /// Interface for compilation databases. > > > _______________________________________________ > cfe-commits mailing list > cfe-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits