Index: include/clang/Basic/Diagnostic.h |
=================================================================== |
--- include/clang/Basic/Diagnostic.h (revision 145976) |
+++ include/clang/Basic/Diagnostic.h (working copy) |
@@ -132,7 +132,8 @@ |
ak_declarationname, // DeclarationName |
ak_nameddecl, // NamedDecl * |
ak_nestednamespec, // NestedNameSpecifier * |
- ak_declcontext // DeclContext * |
+ ak_declcontext, // DeclContext * |
+ ak_qualtype_pair // pair<QualType, QualType> |
}; |
/// Specifies which overload candidates to display when overload resolution |
@@ -154,6 +155,9 @@ |
bool ErrorsAsFatal; // Treat errors like fatal errors. |
bool SuppressSystemWarnings; // Suppress warnings in system headers. |
bool SuppressAllDiagnostics; // Suppress all diagnostics. |
+ bool ElideType; // Elide common types of templates. |
+ bool PrintTemplateTree; // Print a tree when comparing templates. |
+ bool ShowColors; // Color printing is enabled. |
OverloadsShown ShowOverloads; // Which overload candidates to show. |
unsigned ErrorLimit; // Cap of # errors emitted, 0 -> no limit. |
unsigned TemplateBacktraceLimit; // Cap on depth of template backtrace stack, |
@@ -403,7 +407,22 @@ |
SuppressAllDiagnostics = Val; |
} |
bool getSuppressAllDiagnostics() const { return SuppressAllDiagnostics; } |
- |
+ |
+ /// \brief Set type eliding, to skip outputing same types occuring in |
+ /// template types. |
+ void setElideType(bool Val = true) { ElideType = Val; } |
+ bool getElideType() { return ElideType; } |
+ |
+ /// \brief Set type eliding, to skip outputing same types occuring in |
+ /// template types. |
+ void setPrintTemplateTree(bool Val = false) { PrintTemplateTree = Val; } |
+ bool getPrintTemplateTree() { return PrintTemplateTree; } |
+ |
+ /// \brief Set type eliding, to skip outputing same types occuring in |
+ /// template types. |
+ void setShowColors(bool Val = false) { ShowColors = Val; } |
+ bool getShowColors() { return ShowColors; } |
+ |
/// \brief Specify which overload candidates to show when overload resolution |
/// fails. By default, we show all candidates. |
void setShowOverloads(OverloadsShown Val) { |
@@ -614,6 +633,9 @@ |
/// sort of argument kind it is. |
intptr_t DiagArgumentsVal[MaxArguments]; |
+ /// \brief Stores a pair of types for type diffing. |
+ intptr_t FromType, ToType; |
+ |
/// DiagRanges - The list of ranges added to this diagnostic. It currently |
/// only support 10 ranges, could easily be extended if needed. |
CharSourceRange DiagRanges[10]; |
@@ -705,7 +727,11 @@ |
void operator=(const DiagnosticBuilder&); // DO NOT IMPLEMENT |
friend class DiagnosticsEngine; |
explicit DiagnosticBuilder(DiagnosticsEngine *diagObj) |
- : DiagObj(diagObj), NumArgs(0), NumRanges(0), NumFixItHints(0) {} |
+ : DiagObj(diagObj), NumArgs(0), NumRanges(0), NumFixItHints(0) { |
+ // FromType and ToType aren't cleared from the last use, so blank them here. |
+ diagObj->FromType = 0; |
+ diagObj->ToType = 0; |
+ } |
friend class PartialDiagnostic; |
@@ -803,6 +829,14 @@ |
if (DiagObj) |
DiagObj->FixItHints[NumFixItHints++] = Hint; |
} |
+ |
+ void AddTypePair(intptr_t FromType, intptr_t ToType) const { |
+ assert(DiagObj->FromType == 0 && DiagObj->ToType == 0 && |
+ "Only one type diff allowed per diagnostic"); |
+ DiagObj->FromType = FromType; |
+ DiagObj->ToType = ToType; |
+ DiagObj->DiagArgumentsKind[NumArgs++] = DiagnosticsEngine::ak_qualtype_pair; |
+ } |
}; |
inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, |
@@ -959,7 +993,14 @@ |
return DiagObj->DiagArgumentsVal[Idx]; |
} |
+ intptr_t getFromDiffType() const { |
+ return DiagObj->FromType; |
+ } |
+ intptr_t getToDiffType() const { |
+ return DiagObj->ToType; |
+ } |
+ |
/// getNumRanges - Return the number of source ranges associated with this |
/// diagnostic. |
unsigned getNumRanges() const { |
@@ -1109,6 +1150,19 @@ |
} |
}; |
+enum TemplateDiffFlags { |
+ TD_PrintTree = 1, |
+ TD_PrintFromType = 2, |
+ TD_ElideType = 4, |
+ TD_ShowColors = 8 |
+}; |
+ |
+enum { |
+ /// Special character that the diagnostic printer will use to toggle the bold |
+ /// attribute. The character itself will be not be printed. |
+ ToggleBold = 127 |
+}; |
+ |
} // end namespace clang |
#endif |