Skip to content

Commit 6edcb65

Browse files
committed
address more of Erich's feedback
1 parent 8aee255 commit 6edcb65

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

clang/include/clang/Sema/Overload.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ class Sema;
407407
Third == ICK_Identity;
408408
}
409409

410+
/// A conversion sequence is perfect if it is an identity conversion and
411+
/// the type of the source is the same as the type of the target.
410412
bool isPerfect(const ASTContext &C) const {
411413
if (!isIdentityConversion())
412414
return false;
@@ -759,8 +761,7 @@ class Sema;
759761
Standard.setAllToTypes(T);
760762
}
761763

762-
/// A conversion sequence is perfect if
763-
/// it is an identity conversion and
764+
/// A conversion sequence is perfect if it is an identity conversion and
764765
/// the type of the source is the same as the type of the target.
765766
bool isPerfect(const ASTContext &C) const {
766767
return isStandard() && Standard.isPerfect(C);
@@ -1008,9 +1009,7 @@ class Sema;
10081009
if (!Viable)
10091010
return false;
10101011
for (const auto &C : Conversions) {
1011-
if (!C.isInitialized())
1012-
return false;
1013-
if (!C.isPerfect(Ctx))
1012+
if (!C.isInitialized() || !C.isPerfect(Ctx))
10141013
return false;
10151014
}
10161015
if (isa_and_nonnull<CXXConversionDecl>(Function))
@@ -1142,6 +1141,9 @@ class Sema;
11421141
/// Resolve a call through the address of an overload set.
11431142
CSK_AddressOfOverloadSet,
11441143

1144+
/// When doing overload resolution during code completion,
1145+
/// we want to show all viable candidates, including otherwise
1146+
/// deferred template candidates.
11451147
CSK_CodeCompletion,
11461148
};
11471149

@@ -1217,7 +1219,7 @@ class Sema;
12171219
SmallVector<OverloadCandidate, 16> Candidates;
12181220
llvm::SmallPtrSet<uintptr_t, 16> Functions;
12191221

1220-
DeferredTemplateOverloadCandidate *FirstDeferredCandidate;
1222+
DeferredTemplateOverloadCandidate *FirstDeferredCandidate = nullptr;
12211223
unsigned DeferredCandidatesCount : 8 * sizeof(unsigned) - 2;
12221224
LLVM_PREFERRED_TYPE(bool)
12231225
unsigned HasDeferredTemplateConstructors : 1;

clang/include/clang/Sema/Sema.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
#include "clang/Sema/DeclSpec.h"
6161
#include "clang/Sema/ExternalSemaSource.h"
6262
#include "clang/Sema/IdentifierResolver.h"
63-
#include "clang/Sema/Overload.h"
6463
#include "clang/Sema/Ownership.h"
6564
#include "clang/Sema/ParsedAttr.h"
6665
#include "clang/Sema/Redeclaration.h"
@@ -10393,7 +10392,6 @@ class Sema final : public SemaBase {
1039310392
/// Add a C++ function template specialization as a candidate
1039410393
/// in the candidate set, using template argument deduction to produce
1039510394
/// an appropriate function template specialization.
10396-
1039710395
void AddTemplateOverloadCandidate(
1039810396
FunctionTemplateDecl *FunctionTemplate, DeclAccessPair FoundDecl,
1039910397
TemplateArgumentListInfo *ExplicitTemplateArgs, ArrayRef<Expr *> Args,

0 commit comments

Comments
 (0)