summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/Sema.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-20 22:48:49 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-20 22:48:49 +0000
commitda17bd34e7b9c3c090131e84ec607f7426a21f2a (patch)
tree1ad0452fd718cd23bef92fec2b57cd6518fa96f6 /clang/lib/Sema/Sema.cpp
parent7117a916f5784b0d06ff863b09a2bf41560c6096 (diff)
downloadbcm5719-llvm-da17bd34e7b9c3c090131e84ec607f7426a21f2a.tar.gz
bcm5719-llvm-da17bd34e7b9c3c090131e84ec607f7426a21f2a.zip
Eliminate post-diagnostic hooks. Instead, implement a Sema-specific
variant of DiagnosticBuilder that emits the template instantiation backtrace when needed. llvm-svn: 67413
Diffstat (limited to 'clang/lib/Sema/Sema.cpp')
-rw-r--r--clang/lib/Sema/Sema.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 992d3ecbee2..9662c43bb3e 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -295,3 +295,19 @@ NamedDecl *Sema::getCurFunctionOrMethodDecl() {
return 0;
}
+Sema::SemaDiagnosticBuilder::~SemaDiagnosticBuilder() {
+ this->Emit();
+
+ // If this is not a note, and we're in a template instantiation
+ // that is different from the last template instantiation where
+ // we emitted an error, print a template instantiation
+ // backtrace.
+ if (!SemaRef.Diags.isBuiltinNote(DiagID) &&
+ !SemaRef.ActiveTemplateInstantiations.empty() &&
+ SemaRef.ActiveTemplateInstantiations.back()
+ != SemaRef.LastTemplateInstantiationErrorContext) {
+ SemaRef.PrintInstantiationStack();
+ SemaRef.LastTemplateInstantiationErrorContext
+ = SemaRef.ActiveTemplateInstantiations.back();
+ }
+}
OpenPOWER on IntegriCloud