aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-05-07 06:16:58 +0000
committerJohn McCall <rjmccall@apple.com>2012-05-07 06:16:58 +0000
commit13489673b84fafaaf49cf5ae4e3bb9a945524dcb (patch)
tree992446022621abc50aac6bed76ada78854358068 /lib/Sema/SemaDeclAttr.cpp
parent3f152e65074b70e8c13c876ed8b552cb1e6194d7 (diff)
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
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index e3a21694ac..f2d1d19d22 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -4200,8 +4200,7 @@ static void handleDelayedForbiddenType(Sema &S, DelayedDiagnostic &diag,
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 @@ void Sema::PopParsingDeclaration(ParsingDeclState state, Decl *decl) {
// 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 @@ void Sema::PopParsingDeclaration(ParsingDeclState state, Decl *decl) {
} 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())