From: Richard Smith Date: Thu, 14 Apr 2016 18:32:54 +0000 (+0000) Subject: Fix off-by-one error in worst-case number of offsets needed for an AST record. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=38f7925ef0a25c93ea37a2853b91e4767b50c2b6;p=clang Fix off-by-one error in worst-case number of offsets needed for an AST record. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@266353 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Serialization/ASTWriter.h b/include/clang/Serialization/ASTWriter.h index 5ca94b2c36..a5915e7c7e 100644 --- a/include/clang/Serialization/ASTWriter.h +++ b/include/clang/Serialization/ASTWriter.h @@ -704,7 +704,8 @@ class ASTRecordWriter { /// declaration or type. SmallVector StmtsToEmit; - static const int MaxOffsetIndices = 4; + /// Worst case: bases, vbases, visible and lexical contents, local redecls. + static const int MaxOffsetIndices = 5; /// \brief Indices of record elements that describe offsets within the /// bitcode. These will be converted to offsets relative to the current /// record when emitted. diff --git a/test/Modules/Inputs/cxx-decls-imported.h b/test/Modules/Inputs/cxx-decls-imported.h index a4910fee75..0a172150fc 100644 --- a/test/Modules/Inputs/cxx-decls-imported.h +++ b/test/Modules/Inputs/cxx-decls-imported.h @@ -50,3 +50,8 @@ namespace Alias = Aliased; struct InhCtorA { InhCtorA(int); }; struct InhCtorB : InhCtorA { using InhCtorA::InhCtorA; }; + +struct ClassWithVBases : HasFriends, virtual HasNontrivialDefaultConstructor { + int n; +}; +struct ClassWithVBases;