[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Thu May 22 06:46:27 PDT 2025


================
@@ -3187,9 +3215,48 @@ class CallExpr : public Expr {
   SourceLocation getRParenLoc() const { return RParenLoc; }
   void setRParenLoc(SourceLocation L) { RParenLoc = L; }
 
-  SourceLocation getBeginLoc() const LLVM_READONLY;
-  SourceLocation getEndLoc() const LLVM_READONLY;
+  SourceLocation getBeginLoc() const {
+    if (CallExprBits.HasTrailingSourceLoc) {
+        assert(CallExprBits.HasTrailingSourceLoc && "No trailing source loc");
----------------
erichkeane wrote:

What is the point of this assert?  Right after you just did the same thing in the 'if' above?

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


More information about the cfe-commits mailing list