File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -119,8 +119,8 @@ const Type *HeuristicResolver::getPointeeType(const Type *T) const {
119
119
120
120
std::vector<const NamedDecl *> HeuristicResolver::resolveMemberExpr (
121
121
const CXXDependentScopeMemberExpr *ME) const {
122
- // If the expression has a qualifier, first try resolving the member
123
- // inside the qualifier's type.
122
+ // If the expression has a qualifier, try resolving the member inside the
123
+ // qualifier's type.
124
124
// Note that we cannot use a NonStaticFilter in either case, for a couple
125
125
// of reasons:
126
126
// 1. It's valid to access a static member using instance member syntax,
@@ -137,10 +137,15 @@ std::vector<const NamedDecl *> HeuristicResolver::resolveMemberExpr(
137
137
if (!Decls.empty ())
138
138
return Decls;
139
139
}
140
+
141
+ // Do not proceed to try resolving the member in the expression's base type
142
+ // without regard to the qualifier, as that could produce incorrect results.
143
+ // For example, `void foo() { this->Base::foo(); }` shouldn't resolve to
144
+ // foo() itself!
145
+ return {};
140
146
}
141
147
142
- // If that didn't yield any results, try resolving the member inside
143
- // the expression's base type.
148
+ // Try resolving the member inside the expression's base type.
144
149
const Type *BaseType = ME->getBaseType ().getTypePtrOrNull ();
145
150
if (ME->isArrow ()) {
146
151
BaseType = getPointeeType (BaseType);
Original file line number Diff line number Diff line change @@ -1009,7 +1009,17 @@ TEST(LocateSymbol, All) {
1009
1009
void play(Dog *dog) {
1010
1010
[dog ho^wl];
1011
1011
}
1012
- )objc" };
1012
+ )objc" ,
1013
+ R"cpp(
1014
+ struct PointerIntPairInfo {
1015
+ static void *getPointer(void *Value);
1016
+ };
1017
+
1018
+ template <typename Info = PointerIntPairInfo> struct PointerIntPair {
1019
+ void *Value;
1020
+ void *getPointer() const { return Info::get^Pointer(Value); }
1021
+ };
1022
+ )cpp" };
1013
1023
for (const char *Test : Tests) {
1014
1024
Annotations T (Test);
1015
1025
std::optional<Range> WantDecl;
You can’t perform that action at this time.
0 commit comments