[PATCH] D85611: Improve dynamic AST matching diagnostics for conversion errors

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 18 07:47:49 PDT 2020


sammccall accepted this revision.
sammccall added a comment.
This revision is now accepted and ready to land.

Sorry about the delay, good guess as to what was happening :-)



================
Comment at: clang/lib/ASTMatchers/Dynamic/Marshallers.h:88
+  static bool hasCorrectValue(const VariantValue &Value) {
+    return Value.getMatcher().hasTypedMatcher<T>();
   }
----------------
If the matcher type is incorrect e.g. `hasValueType(cxxRecordDecl())` I think this report "value not found: cxxRecordDecl()" or something like that - really this is a type error.

This is minor and probably not worse than "matcher != matcher" today.

But for ideal error messages we might want to give the traits more responsibility for the structure of their error conditions (e.g. changing get() to return Expected<T>)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85611/new/

https://reviews.llvm.org/D85611



More information about the cfe-commits mailing list