[clang] [clang] Optimize castToDeclContext for 2% improvement in build times (PR #76825)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 3 23:22:24 PST 2024


https://github.com/Endilll commented:

Core idea of removing `DECL_CONTEXT_BASE` and range checks for `DeclContext` nodes seems correct to me, as all this machinery wasn't intended for `DeclContext` in the first place. This is apparent from TableGen definition, which lacks any base parameter:
https://github.com/llvm/llvm-project/blob/463dad107f4cb60ae1d49138143d6797599fb1fb/clang/include/clang/Basic/DeclNodes.td#L10

But changes made to `ClangASTNodesEmitter.cpp` are not as clear to me. I'd expect it to simply opt out `DeclContext` nodes from some code generation, but instead I see a lot of changes concerned with `PrioritizedClasses`. It would be nice if you explain what's going on in that file.

https://github.com/llvm/llvm-project/pull/76825


More information about the cfe-commits mailing list