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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 23 09:14:27 PDT 2020


aaron.ballman closed this revision.
aaron.ballman added a comment.

Thank you for the review. I've commit in 819ff6b945816dce144c8be577a3c245f702b59c <https://reviews.llvm.org/rG819ff6b945816dce144c8be577a3c245f702b59c>



================
Comment at: clang/lib/ASTMatchers/Dynamic/Marshallers.h:88
+  static bool hasCorrectValue(const VariantValue &Value) {
+    return Value.getMatcher().hasTypedMatcher<T>();
   }
----------------
sammccall wrote:
> 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>)
That's a good idea for a future change!


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

https://reviews.llvm.org/D85611



More information about the cfe-commits mailing list