llvm-project/clang/unittests
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
..
AST [ASTImporter] Refactor IsStructurallyEquivalent's Decl overloads to be more consistent 2020-09-21 16:41:00 +02:00
ASTMatchers Improve dynamic AST matching diagnostics for conversion errors 2020-09-23 12:13:36 -04:00
Analysis Assignment and Inc/Dec operators wouldn't register as a mutation when Implicit Paren Casts were present 2020-06-09 19:45:57 +01:00
Basic [ADT] Move FixedPoint.h from Clang to LLVM. 2020-08-20 10:29:45 +02:00
CodeGen [AIX] Static init frontend recovery and backend support 2020-08-10 10:10:49 -04:00
CrossTU [clang][NFC] Add a missing 'override' 2020-07-17 17:35:59 -07:00
DirectoryWatcher [DirectoryWatcher] Fix misuse of FSEvents API and data race 2020-02-11 09:25:38 -08:00
Driver [flang][driver] Add the new flang compiler and frontend drivers 2020-09-11 10:55:54 +01:00
Format Add -Wno-error=unknown flag to clang-format. 2020-09-19 10:17:57 +02:00
Frontend Correctly set CompilingPCH in PrecompilePreambleAction. 2020-08-10 17:49:23 +02:00
Index [clang] Do not consider the template arguments of bases to be bases themselves 2020-09-01 19:18:03 -04:00
Lex [clang] Make sure argument expansion locations are correct in presence of predefined buffer 2020-04-22 21:01:52 +02:00
Rename [OpenMP] "UnFix" layering problem with FrontendOpenMP 2020-04-07 14:41:18 -05:00
Rewrite [Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug 2019-08-15 21:17:48 +00:00
Sema Use libClangTesting in the unittest for AST matchers 2020-06-04 17:40:39 +02:00
Serialization Revert "[modules] Do not cache invalid state for modules that we attempted to load." 2020-03-10 10:59:26 -07:00
StaticAnalyzer [analyzer] Fix out-of-tree only clang build by not relaying on private header 2020-07-31 10:28:14 +02:00
Tooling [SyntaxTree] Test the List API 2020-09-22 17:07:41 +00:00
libclang [libclang] Add CXRewriter to libclang API 2020-09-04 14:17:03 -07:00
CMakeLists.txt Use INTERFACE_COMPILE_OPTIONS to disable -Wsuggest-override for any target that links to gtest 2020-07-27 08:37:01 -07:00