]> granicus.if.org Git - clang/commit
[AST] Store Decl* and Stmt* directly into the ParentMap.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 22 Oct 2015 11:21:40 +0000 (11:21 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 22 Oct 2015 11:21:40 +0000 (11:21 +0000)
commit8e855094f1bb5aa969979750bebb02ed96494558
treebdd2bb1007925f6edafbc2fc58f15c132599a2a1
parent0f43e2c14827e7d77533d9ccb0bd15f8e9c4dd94
[AST] Store Decl* and Stmt* directly into the ParentMap.

These are by far the most common types to be parents in the AST so it makes
sense to optimize for them. Put them directly into the value of the map.
This currently saves 32 bytes per parent in the map and a pointer
indirection at the cost of some additional complexity in the code.

Sadly this means we cannot return an ArrayRef from getParents anymore, add
a proxy class that can own a single DynTypedNode and otherwise behaves
exactly the same as ArrayRef.

For example on a random large file (X86ISelLowering.cpp) this reduces the
size of the parent map by 24 MB.

Differential Revision: http://reviews.llvm.org/D13976

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@251008 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/AST/ASTContext.h
lib/AST/ASTContext.cpp