[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");
+ static_assert(sizeof(CallExpr) <=
+ offsetToTrailingObjects + sizeof(SourceLocation));
+ return *reinterpret_cast<const SourceLocation *>(
+ reinterpret_cast<const char *>(this) + sizeof(CallExpr));
+ }
+
+ if (usesMemberSyntax()) {
----------------
erichkeane wrote:
no curleys on single liners?
https://github.com/llvm/llvm-project/pull/141058
More information about the cfe-commits
mailing list