r266353 - Fix off-by-one error in worst-case number of offsets needed for an AST record.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 14 11:32:55 PDT 2016


Author: rsmith
Date: Thu Apr 14 13:32:54 2016
New Revision: 266353

URL: http://llvm.org/viewvc/llvm-project?rev=266353&view=rev
Log:
Fix off-by-one error in worst-case number of offsets needed for an AST record.

Modified:
    cfe/trunk/include/clang/Serialization/ASTWriter.h
    cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h

Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=266353&r1=266352&r2=266353&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTWriter.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTWriter.h Thu Apr 14 13:32:54 2016
@@ -704,7 +704,8 @@ class ASTRecordWriter {
   /// declaration or type.
   SmallVector<Stmt *, 16> 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.

Modified: cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h?rev=266353&r1=266352&r2=266353&view=diff
==============================================================================
--- cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h (original)
+++ cfe/trunk/test/Modules/Inputs/cxx-decls-imported.h Thu Apr 14 13:32:54 2016
@@ -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;




More information about the cfe-commits mailing list