Skip to content

Commit e3b25f4

Browse files
committed
fix cuda, add comments
1 parent 84bdf9e commit e3b25f4

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

clang/include/clang/Sema/Overload.h

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

clang/lib/Sema/SemaOverload.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "clang/Sema/Lookup.h"
3232
#include "clang/Sema/Overload.h"
3333
#include "clang/Sema/SemaCUDA.h"
34-
#include "clang/Sema/SemaCodeCompletion.h"
3534
#include "clang/Sema/SemaObjC.h"
3635
#include "clang/Sema/Template.h"
3736
#include "clang/Sema/TemplateDeduction.h"

clang/test/SemaCUDA/function-overload.cu

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// REQUIRES: x86-registered-target
2-
// REQUIRES: nvptx-registered-target
3-
41
// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-linux-gnu -fsyntax-only \
52
// RUN: -verify=host,hostdefer,devdefer,expected %s
63
// RUN: %clang_cc1 -std=c++14 -triple nvptx64-nvidia-cuda -fsyntax-only \

0 commit comments

Comments
 (0)