@@ -1199,14 +1199,17 @@ class Sema;
11991199 llvm::SmallPtrSet<uintptr_t , 16 > Functions;
12001200 SmallVector<DeferredTemplateOverloadCandidate, 8 > DeferredCandidates;
12011201
1202- // Allocator for ConversionSequenceLists. We store the first few of these
1202+ // Allocator for ConversionSequenceLists and deferred candidate args.
1203+ // We store the first few of these
12031204 // inline to avoid allocation for small sets.
12041205 llvm::BumpPtrAllocator SlabAllocator;
12051206
12061207 SourceLocation Loc;
12071208 CandidateSetKind Kind;
12081209 OperatorRewriteInfo RewriteInfo;
12091210
1211+ // / Small storage size for ImplicitConversionSequences
1212+ // / and the persisted arguments of deferred candidates.
12101213 constexpr static unsigned NumInlineBytes =
12111214 32 * sizeof (ImplicitConversionSequence);
12121215
@@ -1304,6 +1307,11 @@ class Sema;
13041307 return ConversionSequenceList (Conversions, NumConversions);
13051308 }
13061309
1310+ // / Provide storage for any Expr* arg that must be preserved
1311+ // / until deferred template candidates are deduced.
1312+ // / Typically this should be used for reversed operator arguments
1313+ // / and any time the argument array is transformed while adding
1314+ // / a template candidate.
13071315 llvm::MutableArrayRef<Expr *> getPersistentArgsArray (unsigned N) {
13081316 Expr **Exprs = slabAllocate<Expr *>(N);
13091317 return llvm::MutableArrayRef<Expr *>(Exprs, N);
@@ -1454,10 +1462,9 @@ class Sema;
14541462 // When doing code completion, we want to see all the
14551463 // viable candidates.
14561464 && Kind != CSK_CodeCompletion
1457- // When -fgpu-exclude-wrong-side-overloads, CUDA needs
1458- // to exclude templates from the overload sets after they
1459- // have been instantiated. See CudaExcludeWrongSideCandidates.
1460- && (!Opts.CUDA || !Opts.GPUExcludeWrongSideOverloads );
1465+ // CUDA may prefer template candidates even when a non-candidate
1466+ // is a perfect match
1467+ && !Opts.CUDA ;
14611468 }
14621469
14631470} // namespace clang
0 commit comments