================
@@ -158,9 +158,9 @@ class CXXOperatorCallExpr final : public CallExpr {
                : getOperatorLoc();
   }
 
-  SourceLocation getBeginLoc() const { return Range.getBegin(); }
-  SourceLocation getEndLoc() const { return Range.getEnd(); }
-  SourceRange getSourceRange() const { return Range; }
+  SourceLocation getBeginLoc() const { return BeginLoc; }
+  SourceLocation getEndLoc() const { return getSourceRangeImpl().getEnd(); }
----------------
hokein wrote:

We could do this, and apply the same approach to `getBeginLocImpl` as well. 
However, I’m not sure it’s a good idea to split `getSourceRangeImpl` across two 
places -- it makes the logic harder to follow and reason about.

I actually tried this approach in an earlier version of the patch, but didn’t 
observe any performance benefit. Personally, I prefer the current version, 
which keeps all the logic centralized in getSourceRangeImpl for better 
maintainability and clarity.

https://github.com/llvm/llvm-project/pull/147028
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to