From e59331ac3420d5028d986ada5c7ad826500d1e12 Mon Sep 17 00:00:00 2001
From: Richard Trieu This formatter indicates that the fully-qualified name of the declaration should be printed, e.g., "std::vector" rather than "vector". This formatter takes two QualTypes and attempts to print a template difference between the two. If tree printing is off, the entire text inside the the braces, with the formatted text replacing the pipes. If tree printing is on, the text is not printed and a type tree is printed after the diagnostic message.Formatting a Diagnostic Argument
Example: "candidate found by name lookup is %q0" Class: NamedDecl*
+
+Description
+"diff" format
+Example: "no known conversion %diff{from | to | }1,2"
+Class: QualType
diff --git a/docs/ReleaseNotes.html b/docs/ReleaseNotes.html
index 7bca3bf21898..b820e8dc3fdf 100644
--- a/docs/ReleaseNotes.html
+++ b/docs/ReleaseNotes.html
@@ -121,6 +121,55 @@ Description Improvements to Clang's diagnostics
This functionality can be enabled or disabled separately from
-Wuninitialized with the -Wsometimes-uninitialized warning
flag.
+
+
+int f(vector<map<int, double>>);
+int x = f(vector<map<int, float>>());
+
+ The error message is the same, but the note is different based on the options selected.
+
+template-diff.cpp:5:9: error: no matching function for call to 'f'
+int x = f(vector<map<int, float>>());
+ ^
+
+ Templated type diffing with type elision (default):
+
+template-diff.cpp:4:5: note: candidate function not viable: no known conversion from 'vector<map<[...], float>>' to 'vector<map<[...], double>>' for 1st argument;
+int f(vector<map<int, double>>);
+ ^
+
+ Templated type diffing without type elision (-fno-elide-type):
+
+template-diff.cpp:4:5: note: candidate function not viable: no known conversion from 'vector<map<int, float>>' to 'vector<map<int, double>>' for 1st argument;
+int f(vector<map<int, double>>);
+ ^
+
+ Templated tree printing with type elision (-fdiagnostics-show-template-tree):
+
+template-diff.cpp:4:5: note: candidate function not viable: no known conversion for 1st argument;
+ vector<
+ map<
+ [...],
+ [float != double]>>
+int f(vector<map<int, double>>);
+ ^
+
+ Templated tree printing without type elision (-fdiagnostics-show-template-tree -fno-elide-type):
+
+template-diff.cpp:4:5: note: candidate function not viable: no known conversion for 1st argument;
+ vector<
+ map<
+ int,
+ [float != double]>>
+int f(vector<map<int, double>>);
+ ^
+
+
+ Support for
diff --git a/docs/UsersManual.html b/docs/UsersManual.html
index ae9ebfa394b9..6a620d201857 100644
--- a/docs/UsersManual.html
+++ b/docs/UsersManual.html
@@ -417,6 +417,48 @@ tls_model
attributeFormatting of Diagnostics
"\xxx").
The default for template type printing is to elide as many template +arguments as possible, removing those which are the same in both template types, +leaving only the differences. Adding this flag will print all the template +arguments. If supported by the terminal, highlighting will still appear on +differing arguments.
+ +Default: ++t.cc:4:5: note: candidate function not viable: no known conversion from 'vector<map<[...], map<float, [...]>>>' to 'vector<map<[...], map<double, [...]>>>' for 1st argument; ++-fno-elide-type: +
+t.cc:4:5: note: candidate function not viable: no known conversion from 'vector<map<int, map<float, int>>>' to 'vector<map<int, map<double, int>>>' for 1st argument; ++
For diffing large templated types, this option will cause Clang to +display the templates as an indented text tree, one argument per line, with +differences marked inline. This is compatible with -fno-elide-type.
+ +Default: ++t.cc:4:5: note: candidate function not viable: no known conversion from 'vector<map<[...], map<float, [...]>>>' to 'vector<map<[...], map<double, [...]>>>' for 1st argument; ++-fdiagnostics-show-template-tree +
+t.cc:4:5: note: candidate function not viable: no known conversion for 1st argument; + vector< + map< + [...], + map< + [float != float], + [...]>>> ++
Templates types can be long and difficult to read. Moreso when part of an +error message. Instead of just printing out the type name, Clang has enough +information to remove the common elements and highlight the differences. To +show the template structure more clearly, the templated type can also be +printed as an indented text tree.
+ +Default: template diff with type elision ++t.cc:4:5: note: candidate function not viable: no known conversion from 'vector<map<[...], float>>' to 'vector<map<[...], double>>' for 1st argument; ++-fno-elide-type: template diff without elision +
+t.cc:4:5: note: candidate function not viable: no known conversion from 'vector<map<int, float>>' to 'vector<map<int, double>>' for 1st argument; ++-fdiagnostics-show-template-tree: template tree printing with elision +
+t.cc:4:5: note: candidate function not viable: no known conversion for 1st argument; + vector< + map< + [...], + [float != double]>> ++-fdiagnostics-show-template-tree -fno-elide-type: template tree printing with no elision +
+t.cc:4:5: note:M candidate function not viable: no known conversion for 1st argument; + vector< + map< + int, + [float != double]>> ++
Many errors happen in macros that are sometimes deeply nested. With