[clang] [clang-tools-extra] [clang] Avoid re-evaluating field bitwidth (PR #117732)

Timm Baeder via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 27 22:54:36 PST 2024


Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/117732 at github.com>


tbaederr wrote:

Most recent result: http://llvm-compile-time-tracker.com/compare.php?from=6f16a8bf17ac9a171b5435ee53c3d2bef657bdad&to=65e10089b0ca8e2103e6fcf6b082d2bebd3ef458&stat=instructions%3Au



> The idea is that you'd store an `Expr` like we do elsewhere, and then upon instantiating it/evaluating it, we'd replace it with a `ConstantExpr`. So you don't need separate storage, just replace the current thing.

I was more thinking about other consumers of clang as as a library, e.g. `FieldDecl::setBitWidth()` ensuring that the bitwidth expression is a `ConstantExpr`, but that doesn't work properly because of the reasons above. I'm now asserting the type in `getBitWidthValue()` instead.

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


More information about the cfe-commits mailing list