diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-20 22:48:49 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-20 22:48:49 +0000 |
commit | 25a88bbf042317976f0d9cbfa87dfe89426e8393 (patch) | |
tree | fdff3dace9cd1fc315af2d70992f0a7b75ce50fc /lib/Sema/Sema.cpp | |
parent | b238a8fec3bfa3caa00a8f138b955c00097b43b0 (diff) |
Eliminate post-diagnostic hooks. Instead, implement a Sema-specific
variant of DiagnosticBuilder that emits the template instantiation
backtrace when needed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67413 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/Sema.cpp')
-rw-r--r-- | lib/Sema/Sema.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Sema/Sema.cpp b/lib/Sema/Sema.cpp index 992d3ecbee..9662c43bb3 100644 --- a/lib/Sema/Sema.cpp +++ b/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(); + } +} |