diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-11-10 05:40:41 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-11-10 05:40:41 +0000 |
| commit | 2703bebc58f627a5cdf0bcb9bb205d8f552acf78 (patch) | |
| tree | bd2894642fa488a9afacbced39cb3d90d5139b89 /clang/lib/Serialization/ASTReaderDecl.cpp | |
| parent | 66b291a41b7350cff3bdb86558a97c9c10ddfa46 (diff) | |
| download | bcm5719-llvm-2703bebc58f627a5cdf0bcb9bb205d8f552acf78.tar.gz bcm5719-llvm-2703bebc58f627a5cdf0bcb9bb205d8f552acf78.zip | |
Replace UsingDecl's SmallPtrSet of UsingShadowDecls with a linked list to avoid leaking memory.
Fixes rdar://8649963.
llvm-svn: 118674
Diffstat (limited to 'clang/lib/Serialization/ASTReaderDecl.cpp')
| -rw-r--r-- | clang/lib/Serialization/ASTReaderDecl.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 4fca0927cfc..e49447063e7 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -717,16 +717,7 @@ void ASTDeclReader::VisitUsingDecl(UsingDecl *D) { D->setNestedNameRange(ReadSourceRange(Record, Idx)); D->setTargetNestedNameDecl(Reader.ReadNestedNameSpecifier(Record, Idx)); ReadDeclarationNameLoc(D->DNLoc, D->getDeclName(), Record, Idx); - - // FIXME: It would probably be more efficient to read these into a vector - // and then re-cosntruct the shadow decl set over that vector since it - // would avoid existence checks. - unsigned NumShadows = Record[Idx++]; - for(unsigned I = 0; I != NumShadows; ++I) { - // Avoid invariant checking of UsingDecl::addShadowDecl, the decl may still - // be initializing. - D->Shadows.insert(cast<UsingShadowDecl>(Reader.GetDecl(Record[Idx++]))); - } + D->FirstUsingShadow = cast_or_null<UsingShadowDecl>(Reader.GetDecl(Record[Idx++])); D->setTypeName(Record[Idx++]); NamedDecl *Pattern = cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++])); if (Pattern) @@ -736,7 +727,7 @@ void ASTDeclReader::VisitUsingDecl(UsingDecl *D) { void ASTDeclReader::VisitUsingShadowDecl(UsingShadowDecl *D) { VisitNamedDecl(D); D->setTargetDecl(cast<NamedDecl>(Reader.GetDecl(Record[Idx++]))); - D->setUsingDecl(cast<UsingDecl>(Reader.GetDecl(Record[Idx++]))); + D->UsingOrNextShadow = cast_or_null<NamedDecl>(Reader.GetDecl(Record[Idx++])); UsingShadowDecl *Pattern = cast_or_null<UsingShadowDecl>(Reader.GetDecl(Record[Idx++])); if (Pattern) |

