Apply almost the same fix as D36390 but for templates
Details
Diff Detail
Event Timeline
Here's the file we use in our parameter info tests locally (that don't pass with the trunk of clang, but with your changes should now theoretically pass):
class B
{
public:
/// B ctor
B() {
priv();
spriv();
pub();
spub();
o();
this->priv();
this->spriv();
this->pub();
this->spub();
this->o();
B::priv();
B::spriv();
B::pub();
B::spub();
B::o();
this->B::priv();
this->B::spriv();
this->B::pub();
this->B::spub();
this->B::o();
}
/// a
void pub();
/// b
static void spub();
/// o
void o();
private:
/// c
void priv();
/// d
static void spriv();
};
class C : public B
{
public:
/// e
virtual void cpub() {
cpriv();
cspriv();
cpub();
cspub();
o();
o(1);
o(0.5f);
o(true);
this->cpriv();
this->cspriv();
this->cpub();
this->cspub();
this->o();
C::cpriv();
C::cspriv();
C::cpub();
C::cspub();
C::o();
C::o(1);
C::o(0.5f);
C::o(true);
this->C::cpriv();
this->C::cspriv();
this->C::cpub();
this->C::cspub();
this->C::o();
this->C::o(1);
this->C::o(0.5f);
this->C::o(true);
// base calls
pub();
spub();
this->pub();
this->spub();
B::pub();
B::spub();
B::o();
this->B::pub();
this->B::spub();
this->B::o();
B();
// templates
tfoo<int>();
stfoo<float>();
dfoo<double>();
dfoo(3.5);
dfoo2(1);
sdfoo2(false);
this->tfoo<int>();
this->stfoo<float>();
this->dfoo<double>();
this->dfoo(3.5);
this->dfoo2(1);
this->sdfoo2(false);
C::stfoo<decltype(nullptr)>();
C::sdfoo2(true);
// templates without type arguments (potential deduction)
dfoo();
dfoo2();
sdfoo2();
this->dfoo();
this->dfoo2();
this->sdfoo2();
C::dfoo();
C::dfoo2();
C::sdfoo2();
this->C::dfoo();
this->C::dfoo2();
this->C::sdfoo2();
// other special cases
(B::pub)();
(C::pub)();
(B::o)();
(C::o)();
}
/// f
static void cspub();
/// o override
void o();
/// overload0
void o(int);
/// overload1
void o(float);
private:
/// g
void cpriv();
/// h
static void cspriv();
/// simple template
template<typename T> void tfoo();
/// simple static template
template<typename T> static void stfoo();
/// template with default param
template<typename T> void dfoo(int x = 99-22);
/// template with deduced param
template<typename T> void dfoo(T x);
/// template with deduced param and default param
template<typename T> void dfoo2(T x = 0);
/// static template with deduced param and default param
template<typename T> static inline void sdfoo2(T x = 0) {
};Thanks for the feedback :) I will return to this one and address comments a little bit later.
| lib/Sema/SemaOverload.cpp | ||
|---|---|---|
| 6394 | IsTemplate seems redundant. You could use FunTmpl in the conditions below I think? This avoids maintaining two state variables. | |
| lib/Sema/SemaOverload.cpp | ||
|---|---|---|
| 6394 | I think bool value is more descriptive in this case | |
lgtm
| lib/Sema/SemaOverload.cpp | ||
|---|---|---|
| 6394 | I think FunImpl is clear enough. But up to you. Also this could be const bool IsTemplate = FunTmpl != nullptr; | |
IsTemplate seems redundant. You could use FunTmpl in the conditions below I think? This avoids maintaining two state variables.