[AST] Only store the needed data in IfStmt
authorBruno Ricci <riccibrun@gmail.com>
Sat, 27 Oct 2018 21:12:20 +0000 (21:12 +0000)
committerBruno Ricci <riccibrun@gmail.com>
Sat, 27 Oct 2018 21:12:20 +0000 (21:12 +0000)
commitb1cc94b2e559f12986efaf24d681d4098ee0b3f1
tree03a2e1aec759e38a8065de57d8edfa702e0096b6
parenta5baf86744296f2e8769557e2c41d64d07791766
[AST] Only store the needed data in IfStmt

Only store the needed data in IfStmt. This cuts the size of IfStmt
by up to 3 pointers + 1 SourceLocation. The order of the children
is intentionally kept the same even though it would be more
convenient to put the optional trailing objects last. Additionally
use the newly available space in the bit-fields of Stmt to store
the location of the "if".

The result of this is that for the common case of an
if statement of the form:

if (some_cond)
  some_statement

the size of IfStmt is brought down to 8 bytes + 2 pointers,
instead of 8 bytes + 5 pointers + 2 SourceLocation.

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

Reviewed By: rjmccall

llvm-svn: 345464
clang/include/clang/AST/Stmt.h
clang/lib/AST/ASTDumper.cpp
clang/lib/AST/ASTImporter.cpp
clang/lib/AST/Stmt.cpp
clang/lib/Analysis/BodyFarm.cpp
clang/lib/Sema/SemaStmt.cpp
clang/lib/Serialization/ASTReaderStmt.cpp
clang/lib/Serialization/ASTWriterStmt.cpp
clang/test/Import/if-stmt/test.cpp
clang/test/Misc/ast-dump-invalid.cpp