[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Thu May 22 07:02:42 PDT 2025
================
@@ -3028,6 +3043,19 @@ class CallExpr : public Expr {
bool hasStoredFPFeatures() const { return CallExprBits.HasFPFeatures; }
+ bool usesMemberSyntax() const {
+ return CallExprBits.ExplicitObjectMemFunUsingMemberSyntax;
+ }
+ void setUsesMemberSyntax(bool V = true) {
+ CallExprBits.ExplicitObjectMemFunUsingMemberSyntax = V;
+ // Because the source location may be different for explicit
+ // member, we reset the cached values.
+ if (CallExprBits.HasTrailingSourceLoc) {
+ CallExprBits.HasTrailingSourceLoc = false;
+ updateTrailingSourceLoc();
----------------
erichkeane wrote:
Oh, hrmph... My mental benchmark is whether every callexpr gets its `BeginLoc` queried at least 1x. My hope/intuition is that we wouldn't call it very often unless doing some sort of ast-dump/etc, but the benchmarks obviously show my intuition to be wrong. So this NOT being a use-initiated cache is perhaps the right answer. So, I think I'm talking myself out of this suggestion :)
https://github.com/llvm/llvm-project/pull/141058
More information about the cfe-commits
mailing list