Add a notion of "post-diagnostic hooks", which are callbacks attached
to a diagnostic that will be invoked after the diagnostic (if it is
not suppressed). The hooks are allowed to produce additional
diagnostics (typically notes) that provide more information. We should
be able to use this to help diagnostic clients link notes back to the
diagnostic they clarify. Comments welcome; I'll write up documentation
and convert other clients (e.g., overload resolution failures) if
there are no screams of protest.

As the first client of post-diagnostic hooks, we now produce a
template instantiation backtrace when a failure occurs during template
instantiation. There's still more work to do to make this output
pretty, if that's even possible.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66557 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaTemplate/instantiation-depth.cpp b/test/SemaTemplate/instantiation-depth.cpp
index 3b8acf2..25c40fc 100644
--- a/test/SemaTemplate/instantiation-depth.cpp
+++ b/test/SemaTemplate/instantiation-depth.cpp
@@ -1,8 +1,9 @@
 // RUN: clang -fsyntax-only -ftemplate-depth=5 -verify %s
 
 template<typename T> struct X : X<T*> { }; // expected-error{{recursive template instantiation exceeded maximum depth of 5}} \
-// expected-note{{use -ftemplate-depth=N to increase recursive template instantiation depth}}
+// expected-note{{use -ftemplate-depth=N to increase recursive template instantiation depth}} \
+// expected-note 5 {{instantiation of template class}}
 
 void test() { 
-  (void)sizeof(X<int>);
+  (void)sizeof(X<int>); // expected-note {{instantiation of template class}}
 }