Change how we suppress access control in explicit instantiations
so that we actually accumulate all the delayed diagnostics. Do
this so that we can restore those diagnostics to good standing
if it turns out that we were wrong to suppress, e.g. if the
tag specifier is actually an elaborated type specifier and not
a declaration.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@156291 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index e3a2169..f2d1d19 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -4200,8 +4200,7 @@
void Sema::PopParsingDeclaration(ParsingDeclState state, Decl *decl) {
assert(DelayedDiagnostics.getCurrentPool());
- sema::DelayedDiagnosticPool &poppedPool =
- *DelayedDiagnostics.getCurrentPool();
+ DelayedDiagnosticPool &poppedPool = *DelayedDiagnostics.getCurrentPool();
DelayedDiagnostics.popWithoutEmitting(state);
// When delaying diagnostics to run in the context of a parsed
@@ -4216,9 +4215,9 @@
// only the declarator pops will be passed decls. This is correct;
// we really do need to consider delayed diagnostics from the decl spec
// for each of the different declarations.
- const sema::DelayedDiagnosticPool *pool = &poppedPool;
+ const DelayedDiagnosticPool *pool = &poppedPool;
do {
- for (sema::DelayedDiagnosticPool::pool_iterator
+ for (DelayedDiagnosticPool::pool_iterator
i = pool->pool_begin(), e = pool->pool_end(); i != e; ++i) {
// This const_cast is a bit lame. Really, Triggered should be mutable.
DelayedDiagnostic &diag = const_cast<DelayedDiagnostic&>(*i);
@@ -4244,6 +4243,15 @@
} while ((pool = pool->getParent()));
}
+/// Given a set of delayed diagnostics, re-emit them as if they had
+/// been delayed in the current context instead of in the given pool.
+/// Essentially, this just moves them to the current pool.
+void Sema::redelayDiagnostics(DelayedDiagnosticPool &pool) {
+ DelayedDiagnosticPool *curPool = DelayedDiagnostics.getCurrentPool();
+ assert(curPool && "re-emitting in undelayed context not supported");
+ curPool->steal(pool);
+}
+
static bool isDeclDeprecated(Decl *D) {
do {
if (D->isDeprecated())