]> granicus.if.org Git - clang/commitdiff
Defensively ensure that GetExternalDeclStmt protects itself from nested deserialization
authorDavid Blaikie <dblaikie@gmail.com>
Wed, 8 Mar 2017 23:57:08 +0000 (23:57 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Wed, 8 Mar 2017 23:57:08 +0000 (23:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297322 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Serialization/ASTReader.cpp

index c6564d666b24aa1300cc639662d2f17e5cbacaf6..648c7b48ed884de03d6af74555ef7c703eb1460c 100644 (file)
@@ -6811,6 +6811,9 @@ Stmt *ASTReader::GetExternalDeclStmt(uint64_t Offset) {
   // Offset here is a global offset across the entire chain.
   RecordLocation Loc = getLocalBitOffset(Offset);
   Loc.F->DeclsCursor.JumpToBit(Loc.Offset);
+  assert(NumCurrentElementsDeserializing == 0 &&
+         "should not be called while already deserializing");
+  Deserializing D(this);
   return ReadStmtFromStream(*Loc.F);
 }