diff options
author | Douglas Gregor <dgregor@apple.com> | 2012-03-28 14:34:23 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2012-03-28 14:34:23 +0000 |
commit | 1e1e9722cb4ea6027e2c4885c7a8f26d3726ca7d (patch) | |
tree | 30896acb268f5b20f658960e6d2b54384317d547 /lib/AST/Decl.cpp | |
parent | 6488dc31153be6f98b404c7860be6c66bb4ec917 (diff) |
When we form a new function/class template specialization, we first
search for the specialization (in a folding set) and, if not found
form a *Decl that is then inserted into that folding set. In rare
cases, the folding set may be reallocated between the search and the
insertion, causing a crash. No test case, because triggering rehashing
consistently in a small test case is not feasible. Fixes
<rdar://problem/11115071>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153575 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Decl.cpp')
-rw-r--r-- | lib/AST/Decl.cpp | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index e476bfb6f1..399f2e48ab 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -2255,22 +2255,7 @@ FunctionDecl::setFunctionTemplateSpecialization(ASTContext &C, TemplateArgsAsWritten, PointOfInstantiation); TemplateOrSpecialization = Info; - - // Insert this function template specialization into the set of known - // function template specializations. - if (InsertPos) - Template->addSpecialization(Info, InsertPos); - else { - // Try to insert the new node. If there is an existing node, leave it, the - // set will contain the canonical decls while - // FunctionTemplateDecl::findSpecialization will return - // the most recent redeclarations. - FunctionTemplateSpecializationInfo *Existing - = Template->getSpecializations().GetOrInsertNode(Info); - (void)Existing; - assert((!Existing || Existing->Function->isCanonicalDecl()) && - "Set is supposed to only contain canonical decls"); - } + Template->addSpecialization(Info, InsertPos); } void |