llvm-project/clang/unittests/ASTMatchers
Aaron Ballman 819ff6b945 Improve dynamic AST matching diagnostics for conversion errors
Currently, when marshaling a dynamic AST matchers, we check for the type
and value validity of matcher arguments at the same time for some matchers.
For instance, when marshaling hasAttr("foo"), the argument is first type
checked to ensure it's a string and then checked to see if that string can
locate an attribute with that name. Similar happens for other enumeration
conversions like cast kinds or unary operator kinds. If the type is
correct but the value cannot be looked up, we make a best-effort attempt
to find a nearby name that the user might have meant, but if one cannot
be found, we throw our hands up and claim the types don't match.

This has an unfortunate behavior that when the user enters something of
the correct type but a best guess cannot be located, you get confusing
error messages like:
Incorrect type for arg 1. (Expected = string) != (Actual = String).

This patch splits the argument check into two parts: if the types don't
match, give a type diagnostic. If the type matches but the value cannot
be converted, give a best guess diagnostic or a value could not be
located diagnostic. This addresses PR47057.
2020-09-23 12:13:36 -04:00
..
Dynamic Improve dynamic AST matching diagnostics for conversion errors 2020-09-23 12:13:36 -04:00
ASTMatchersInternalTest.cpp Use libClangTesting in the unittest for AST matchers 2020-06-04 17:40:39 +02:00
ASTMatchersNarrowingTest.cpp Enable the test for hasArraySize() AST matcher in all language modes 2020-07-20 10:23:00 +02:00
ASTMatchersNodeTest.cpp [clang] Add a matcher for template template parameters. 2020-08-11 16:01:36 +01:00
ASTMatchersTest.h Use TestClangConfig in AST Matchers tests and run them in more configurations 2020-07-16 18:36:53 +02:00
ASTMatchersTraversalTest.cpp [ASTMatchers] Fix `hasBody` for the descendants of `FunctionDecl` 2020-09-16 13:16:51 +02:00
CMakeLists.txt On Windows build, making the /bigobj flag global , instead of passing it per file. 2020-07-28 18:04:36 -05:00
GtestMatchersTest.cpp [AST matchers] Add basic matchers for googletest EXPECT/ASSERT calls. 2020-02-21 12:05:15 -05:00