diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-02-23 02:09:03 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2017-02-23 02:09:03 +0000 |
commit | 1a04b13fd8f7b63a60f34c0e64dd184559ba8c74 (patch) | |
tree | d85b65e0a5e825cd89c5ab35cc3c64b5f924deaa /lib/Sema/SemaTemplateInstantiate.cpp | |
parent | cf0ea16a2daa40c51bc75d21f109d9667cc88177 (diff) |
Fix tracking of whether the previous template instantiation stack matches the current one.
Rather than attempting to compare whether the previous and current top of
context stack are "equal" (which fails for a number of reasons, such as the
context stack entries containing pointers to objects on the stack, or reaching
the same "top of stack" entry through two different paths), track the depth of
context stack at which we last emitted a note and invalidate it when we pop the
context stack to less than that depth.
This causes us to emit some missing "in instantiation of" notes and to stop
emitting redundant "in instantiation of" stacks matching the previous stack in
rare cases.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@295921 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | lib/Sema/SemaTemplateInstantiate.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 94e79f5c50..7b09b77da3 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -369,6 +369,12 @@ void Sema::InstantiatingTemplate::Clear() { SemaRef.CodeSynthesisContextLookupModules.pop_back(); } + // If we've left the code synthesis context for the current context stack, + // stop remembering that we've emitted that stack. + if (SemaRef.CodeSynthesisContexts.size() == + SemaRef.LastEmittedCodeSynthesisContextDepth) + SemaRef.LastEmittedCodeSynthesisContextDepth = 0; + if (!AlreadyInstantiating) SemaRef.InstantiatingSpecializations.erase( std::make_pair(Active.Entity, Active.Kind)); |