[PATCH] D34798: [Dominators] Add CFGBuilder testing utility
Jakub Kuderski via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 29 16:31:17 PDT 2017
kuhar added inline comments.
================
Comment at: unittests/IR/CFGBuilder.cpp:33-35
+bool llvm::operator<(const CFGBuilder::Arc &LHS, const CFGBuilder::Arc &RHS) {
+ return std::tie(LHS.From, LHS.To) < std::tie(RHS.From, RHS.To);
+}
----------------
dblaikie wrote:
> Oh, you could still have this inline in the header - just important that it's not a member function. It doesn't need to be a friend though, since this is a struct with only public members.
>
> But if you do declare it as a friend (though it's not necessary/might be slightly confusing to a reader "why is this a friend if there's nothing private to access?") you can define it inline at the friend declaration - which keeps it written right where it was when it was a member function, close to the type it's defined for, etc, which is nice.
The thing is that I keep Arcs in a `std::set`, which uses the less-than operator and I think that it needs to be declared before using it.
And if I go with declaring it inline, then I'll also have to pull in the entire `<tuple>`. I'm not sure if something includes it transitively -- if that's the case, I'm more than happy to keep it inline.
https://reviews.llvm.org/D34798
More information about the llvm-commits
mailing list