Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NFC] Fix some warnings and errors under C++20 #2078

Merged
merged 1 commit into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/Driver/ToolChains/Cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class LLVM_LIBRARY_VISIBILITY CudaToolChain : public ToolChain {

unsigned GetDefaultDwarfVersion() const override { return 2; }

Tool *SelectTool(const JobAction &JA) const;
Tool *SelectTool(const JobAction &JA) const override;

const ToolChain &HostTC;
CudaInstallationDetector CudaInstallation;
Expand Down
21 changes: 8 additions & 13 deletions clang/lib/Sema/SemaSYCL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ void KernelObjVisitor::VisitRecord(CXXRecordDecl *Owner, ParentTy &Parent,

// A base type that the SYCL OpenCL Kernel construction task uses to implement
// individual tasks.
template <typename Derived> class SyclKernelFieldHandler {
class SyclKernelFieldHandler {
protected:
Sema &SemaRef;
SyclKernelFieldHandler(Sema &S) : SemaRef(S) {}
Expand Down Expand Up @@ -1001,11 +1001,12 @@ template <typename Derived> class SyclKernelFieldHandler {
virtual bool enterArray() { return true; }
virtual bool nextElement(QualType) { return true; }
virtual bool leaveArray(FieldDecl *, QualType, int64_t) { return true; }

virtual ~SyclKernelFieldHandler() = default;
};

// A type to check the validity of all of the argument types.
class SyclKernelFieldChecker
: public SyclKernelFieldHandler<SyclKernelFieldChecker> {
class SyclKernelFieldChecker : public SyclKernelFieldHandler {
bool IsInvalid = false;
DiagnosticsEngine &Diag;

Expand Down Expand Up @@ -1101,8 +1102,7 @@ class SyclKernelFieldChecker
};

// A type to Create and own the FunctionDecl for the kernel.
class SyclKernelDeclCreator
: public SyclKernelFieldHandler<SyclKernelDeclCreator> {
class SyclKernelDeclCreator : public SyclKernelFieldHandler {
FunctionDecl *KernelDecl;
llvm::SmallVector<ParmVarDecl *, 8> Params;
SyclKernelFieldChecker &ArgChecker;
Expand Down Expand Up @@ -1286,8 +1286,7 @@ class SyclKernelDeclCreator
using SyclKernelFieldHandler::handleSyclSamplerType;
};

class SyclKernelBodyCreator
: public SyclKernelFieldHandler<SyclKernelBodyCreator> {
class SyclKernelBodyCreator : public SyclKernelFieldHandler {
SyclKernelDeclCreator &DeclCreator;
llvm::SmallVector<Stmt *, 16> BodyStmts;
llvm::SmallVector<Stmt *, 16> FinalizeStmts;
Expand Down Expand Up @@ -1696,12 +1695,8 @@ class SyclKernelBodyCreator
using SyclKernelFieldHandler::leaveStruct;
};

class SyclKernelIntHeaderCreator
: public SyclKernelFieldHandler<SyclKernelIntHeaderCreator> {
class SyclKernelIntHeaderCreator : public SyclKernelFieldHandler {
SYCLIntegrationHeader &Header;
const CXXRecordDecl *KernelObj;
// Necessary to figure out the offset of the base class.
const CXXRecordDecl *CurStruct = nullptr;
int64_t CurOffset = 0;

void addParam(const FieldDecl *FD, QualType ArgTy,
Expand All @@ -1720,7 +1715,7 @@ class SyclKernelIntHeaderCreator
SyclKernelIntHeaderCreator(Sema &S, SYCLIntegrationHeader &H,
const CXXRecordDecl *KernelObj, QualType NameType,
StringRef Name, StringRef StableName)
: SyclKernelFieldHandler(S), Header(H), KernelObj(KernelObj) {
: SyclKernelFieldHandler(S), Header(H) {
Header.startKernel(Name, NameType, StableName, KernelObj->getLocation());
}

Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/Support/PropertySetIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class PropertyValue {
// Casts from int value to a type tag.
static Expected<Type> getTypeTag(int T) {
if (T < first || T > last)
return createStringError(std::error_code(), "bad property type " + T);
return createStringError(std::error_code(), "bad property type ", T);
return static_cast<Type>(T);
}

Expand Down
7 changes: 4 additions & 3 deletions llvm/lib/Support/PropertySetIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ PropertySetRegistry::read(const MemoryBuffer *Buf) {
case PropertyValue::Type::UINT32: {
APInt ValV;
if (Val.getAsInteger(10, ValV))
return createStringError(EC, "invalid property value: " + Val);
return createStringError(EC, "invalid property value: ", Val.data());
Prop.set(static_cast<uint32_t>(ValV.getZExtValue()));
break;
}
default:
return createStringError(EC, "unsupported property type: " + Ttag.get());
return createStringError(EC, "unsupported property type: ", Ttag.get());
}
(*CurPropSet)[Parts.first] = Prop;
}
Expand All @@ -85,7 +85,8 @@ raw_ostream &operator<<(raw_ostream &Out, const PropertyValue &Prop) {
Out << Prop.asUint32();
break;
default:
llvm_unreachable_internal("unsupported property type: " + Prop.getType());
llvm_unreachable(
("unsupported property type: " + utostr(Prop.getType())).c_str());
}
return Out;
}
Expand Down
2 changes: 2 additions & 0 deletions sycl/include/CL/sycl/id.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ template <int dimensions = 1> class id : public detail::array<dimensions> {
// OP is: ==, !=
#ifndef __SYCL_DISABLE_ID_TO_INT_CONV__
using detail::array<dimensions>::operator==;
#if __cpp_impl_three_way_comparison < 201907
using detail::array<dimensions>::operator!=;
#endif

/* Enable operators with integral types.
* Template operators take precedence than type conversion. In the case of
Expand Down
2 changes: 1 addition & 1 deletion sycl/source/detail/os_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct ModuleInfo {
constexpr OSModuleHandle OSUtil::ExeModuleHandle;
constexpr OSModuleHandle OSUtil::DummyModuleHandle;

static int callback(struct dl_phdr_info *Info, size_t Size, void *Data) {
static int callback(struct dl_phdr_info *Info, size_t, void *Data) {
auto Base = reinterpret_cast<unsigned char *>(Info->dlpi_addr);
auto MI = reinterpret_cast<ModuleInfo *>(Data);
auto TestAddr = reinterpret_cast<const unsigned char *>(MI->VirtAddr);
Expand Down