diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-07-06 18:54:52 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-07-06 18:54:52 +0000 |
commit | 1342e84c1753ddaf67edcf2e7840cbf9f9033291 (patch) | |
tree | 6a5f1a50a4a25c71b6dde3e73153373642aae1a8 /clang/lib/Frontend/PCHReaderDecl.cpp | |
parent | 1d182d08baa5632f64ad32957e814302a2303178 (diff) | |
download | bcm5719-llvm-1342e84c1753ddaf67edcf2e7840cbf9f9033291.tar.gz bcm5719-llvm-1342e84c1753ddaf67edcf2e7840cbf9f9033291.zip |
Fix PR 4489, a crash in PCH loading that occurs when loading the name
of a top-level declaration loads another top-level declaration of the
same name whose type depends on the first declaration having been
completed. This commit breaks the circular dependency by delaying
loads of top-level declarations triggered by loading a name until we
are no longer recursively loading types or declarations.
llvm-svn: 74847
Diffstat (limited to 'clang/lib/Frontend/PCHReaderDecl.cpp')
-rw-r--r-- | clang/lib/Frontend/PCHReaderDecl.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Frontend/PCHReaderDecl.cpp b/clang/lib/Frontend/PCHReaderDecl.cpp index 15b54a2d4fc..94e46acac34 100644 --- a/clang/lib/Frontend/PCHReaderDecl.cpp +++ b/clang/lib/Frontend/PCHReaderDecl.cpp @@ -581,6 +581,9 @@ Decl *PCHReader::ReadDeclRecord(uint64_t Offset, unsigned Index) { // after reading this declaration. SavedStreamPosition SavedPosition(DeclsCursor); + // Note that we are loading a declaration record. + LoadingTypeOrDecl Loading(*this); + DeclsCursor.JumpToBit(Offset); RecordData Record; unsigned Code = DeclsCursor.ReadCode(); |