Genericize the qualtype formating callback to support any diag argument.
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59908 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp
index d43eadd..b01b5d7 100644
--- a/lib/Sema/Sema.cpp
+++ b/lib/Sema/Sema.cpp
@@ -22,12 +22,13 @@
/// ConvertQualTypeToStringFn - This function is used to pretty print the
/// specified QualType as a string in diagnostics.
-static void ConvertQualTypeToStringFn(intptr_t QT,
+static void ConvertArgToStringFn(Diagnostic::ArgumentKind Kind, intptr_t QT,
const char *Modifier, unsigned ML,
const char *Argument, unsigned ArgLen,
llvm::SmallVectorImpl<char> &Output) {
assert(ML == 0 && ArgLen == 0 && "Invalid modifier for QualType argument");
-
+ assert(Kind == Diagnostic::ak_qualtype);
+
QualType Ty(QualType::getFromOpaquePtr(reinterpret_cast<void*>(QT)));
// FIXME: Playing with std::string is really slow.
@@ -126,7 +127,7 @@
FieldCollector.reset(new CXXFieldCollector());
// Tell diagnostics how to render things from the AST library.
- PP.getDiagnostics().SetQualTypeToStringFn(ConvertQualTypeToStringFn);
+ PP.getDiagnostics().SetArgToStringFn(ConvertArgToStringFn);
}
/// ImpCastExprToType - If Expr is not of type 'Type', insert an implicit cast.