]> granicus.if.org Git - clang/commit
[AST] Store the string data in StringLiteral in a trailing array of chars
authorBruno Ricci <riccibrun@gmail.com>
Thu, 15 Nov 2018 17:31:16 +0000 (17:31 +0000)
committerBruno Ricci <riccibrun@gmail.com>
Thu, 15 Nov 2018 17:31:16 +0000 (17:31 +0000)
commit2b074a4200135c633ba23aadb1d86b8b60b9c871
tree50c38439f76e9a418b6f7a5609bc940a309e73e9
parentb9e6abd1ea926a4d0b2395a4e6e1a1f2f4fe1f7b
[AST] Store the string data in StringLiteral in a trailing array of chars

Use the newly available space in the bit-fields of Stmt and store the
string data in a trailing array of chars after the trailing array
of SourceLocation. This cuts the size of StringLiteral by 2 pointers.

Also refactor slightly StringLiteral::Create and StringLiteral::CreateEmpty
so that StringLiteral::Create is just responsible for the allocation, and the
constructor is responsible for doing all the initialization. This match what
is done for the other classes in general.

This patch should have no other functional changes apart from this.

A concern was raised during review about the interaction between
this patch and serialization abbreviations. I believe however that
there is currently no abbreviation defined for StringLiteral.
The only statements/expressions which have abbreviations are currently
DeclRefExpr, IntegerLiteral, CharacterLiteral and ImplicitCastExpr.

Differential Revision: https://reviews.llvm.org/D54166

Reviewed By: dblaikie, rjmccall

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@346969 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/Expr.h
include/clang/AST/Stmt.h
lib/AST/Expr.cpp
lib/Serialization/ASTReaderStmt.cpp
lib/Serialization/ASTWriterStmt.cpp