summaryrefslogtreecommitdiffstats
path: root/clang/include
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@ericsson.com>2018-07-17 14:13:05 +0000
committerSimon Marchi <simon.marchi@ericsson.com>2018-07-17 14:13:05 +0000
commit6567c9e5e04258daadc9080ed2a388692a4fcdb7 (patch)
treecc55ad85b0131000efdacb1e8b7be15e038e425a /clang/include
parentd95761d9d08340b641225b2cf6d397a06db29137 (diff)
downloadbcm5719-llvm-6567c9e5e04258daadc9080ed2a388692a4fcdb7.tar.gz
bcm5719-llvm-6567c9e5e04258daadc9080ed2a388692a4fcdb7.zip
[Tooling] Add operator== to CompileCommand
Summary: It does the obvious thing of comparing all fields. This will be needed for a clangd patch I have in the pipeline. Subscribers: dblaikie, ilya-biryukov, ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D49265 llvm-svn: 337284
Diffstat (limited to 'clang/include')
-rw-r--r--clang/include/clang/Tooling/CompilationDatabase.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/include/clang/Tooling/CompilationDatabase.h b/clang/include/clang/Tooling/CompilationDatabase.h
index 185e4968797..37e515fdc09 100644
--- a/clang/include/clang/Tooling/CompilationDatabase.h
+++ b/clang/include/clang/Tooling/CompilationDatabase.h
@@ -59,6 +59,15 @@ struct CompileCommand {
/// The output file associated with the command.
std::string Output;
+
+ friend bool operator==(const CompileCommand &LHS, const CompileCommand &RHS) {
+ return LHS.Directory == RHS.Directory && LHS.Filename == RHS.Filename &&
+ LHS.CommandLine == RHS.CommandLine && LHS.Output == RHS.Output;
+ }
+
+ friend bool operator!=(const CompileCommand &LHS, const CompileCommand &RHS) {
+ return !(LHS == RHS);
+ }
};
/// Interface for compilation databases.
OpenPOWER on IntegriCloud