[PATCH] New ASTMatcher and enhancement to hasOverloadedOperatorName

Manuel Klimek klimek at google.com
Wed Mar 6 08:05:57 PST 2013



================
Comment at: include/clang/ASTMatchers/ASTMatchersInternal.h:378
@@ +377,3 @@
+template <typename T, typename ArgT>
+class HasOverloadedOperatorNameMatcher : public SingleNodeMatcherInterface<T> {
+public:
----------------
Edwin Vane wrote:
> Manuel Klimek wrote:
> > Please put in a TOOLING_COMPILE_ASSERT that T is one of the supported types?
> A static assert for T isn't necessary I think since if it isn't one of the supported types you just get an error saying there's no overload for matchesSpecialized() for the given T. This is the same as the HasDeclarationMatcher right below.
> 
> As for ArgT, it can really only be StringRef but the error will point somewhere in PolymorphicMatcherWithParam1 probably as it tries to construct HasOverloadedOperatorName. I'll check the error message and if it's not obvious I'll add a static assert.
I'm aware it isn't necessary, I was hoping we could get a nicer error in. That hasDeclaration doesn't do that doesn't mean it's good, just that it was written before we became aware of the problem of users to understand the template error message :)


http://llvm-reviews.chandlerc.com/D494

BRANCH
  matchers

ARCANIST PROJECT
  clang



More information about the cfe-commits mailing list