Skip to content

Commit f09de04

Browse files
committed
Revert "[clang] Compute accurate begin location for CallExpr with explicit object parameter (llvm#117841)"
This reverts commit 9ccde12.
1 parent 7f59b4e commit f09de04

File tree

4 files changed

+3
-21
lines changed

4 files changed

+3
-21
lines changed

clang-tools-extra/clangd/unittests/XRefsTests.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,15 +1019,6 @@ TEST(LocateSymbol, All) {
10191019
void *Value;
10201020
void *getPointer() const { return Info::get^Pointer(Value); }
10211021
};
1022-
)cpp",
1023-
R"cpp(// Deducing this
1024-
struct S {
1025-
int bar(this S&);
1026-
};
1027-
void foo() {
1028-
S [[waldo]];
1029-
int x = wa^ldo.bar();
1030-
}
10311022
)cpp"};
10321023
for (const char *Test : Tests) {
10331024
Annotations T(Test);
@@ -1044,7 +1035,6 @@ TEST(LocateSymbol, All) {
10441035
TU.Code = std::string(T.code());
10451036

10461037
TU.ExtraArgs.push_back("-xobjective-c++");
1047-
TU.ExtraArgs.push_back("-std=c++23");
10481038

10491039
auto AST = TU.build();
10501040
auto Results = locateSymbolAt(AST, T.point());

clang/lib/AST/Expr.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,19 +1638,11 @@ SourceLocation CallExpr::getBeginLoc() const {
16381638
if (const auto *OCE = dyn_cast<CXXOperatorCallExpr>(this))
16391639
return OCE->getBeginLoc();
16401640

1641-
if (const auto *Method =
1642-
dyn_cast_if_present<const CXXMethodDecl>(getCalleeDecl());
1643-
Method && Method->isExplicitObjectMemberFunction()) {
1644-
assert(getNumArgs() > 0 && getArg(0));
1645-
return getArg(0)->getBeginLoc();
1646-
}
1647-
16481641
SourceLocation begin = getCallee()->getBeginLoc();
16491642
if (begin.isInvalid() && getNumArgs() > 0 && getArg(0))
16501643
begin = getArg(0)->getBeginLoc();
16511644
return begin;
16521645
}
1653-
16541646
SourceLocation CallExpr::getEndLoc() const {
16551647
if (const auto *OCE = dyn_cast<CXXOperatorCallExpr>(this))
16561648
return OCE->getEndLoc();

clang/lib/Sema/SemaOverload.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15606,7 +15606,7 @@ ExprResult Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
1560615606
// Build the actual expression node.
1560715607
ExprResult FnExpr =
1560815608
CreateFunctionRefExpr(*this, Method, FoundDecl, MemExpr,
15609-
HadMultipleCandidates, MemExpr->getExprLoc());
15609+
HadMultipleCandidates, MemExpr->getBeginLoc());
1561015610
if (FnExpr.isInvalid())
1561115611
return ExprError();
1561215612

clang/test/AST/ast-dump-cxx2b-deducing-this.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ int main() {
99
S s;
1010
int x = s.f();
1111
// CHECK: CallExpr 0x{{[^ ]*}} <col:11, col:15> 'int
12-
// CHECK-NEXT: |-ImplicitCastExpr 0x{{[^ ]*}} <col:13> 'int (*)(S &)' <FunctionToPointerDecay>
13-
// CHECK-NEXT: | `-DeclRefExpr 0x{{[^ ]*}} <col:13> 'int (S &)' lvalue CXXMethod 0x{{[^ ]*}} 'f' 'int (S &)'
12+
// CHECK-NEXT: |-ImplicitCastExpr 0x{{[^ ]*}} <col:11> 'int (*)(S &)' <FunctionToPointerDecay>
13+
// CHECK-NEXT: | `-DeclRefExpr 0x{{[^ ]*}} <col:11> 'int (S &)' lvalue CXXMethod 0x{{[^ ]*}} 'f' 'int (S &)'
1414
}
1515
}

0 commit comments

Comments
 (0)