From 690f10df90318899041d7a9c9ebd6948cd79d2e0 Mon Sep 17 00:00:00 2001 From: Balint Cristian Date: Tue, 17 Oct 2023 14:21:10 +0300 Subject: [PATCH] [Minor] Fix compilation warnings for clang --- src/target/llvm/llvm_instance.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/target/llvm/llvm_instance.cc b/src/target/llvm/llvm_instance.cc index 5079822277e5..9e88222059cc 100644 --- a/src/target/llvm/llvm_instance.cc +++ b/src/target/llvm/llvm_instance.cc @@ -68,6 +68,10 @@ #include #if TVM_LLVM_VERSION < 180 +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreturn-stack-address" +#endif namespace llvm { #if TVM_LLVM_VERSION < 170 // SubtargetSubTypeKV view @@ -86,6 +90,9 @@ struct FeatViewer { template struct FeatViewer<&MCSubtargetInfo::ProcFeatures>; ArrayRef& featViewer(MCSubtargetInfo); } // namespace llvm +#if defined(__clang__) +#pragma clang diagnostic pop +#endif #endif namespace tvm { @@ -809,7 +816,7 @@ const Array LLVMTargetInfo::GetAllLLVMTargetArches() const { // get all arches llvm::ArrayRef llvm_arches = #if TVM_LLVM_VERSION < 170 - llvm::archViewer(*(llvm::MCSubtargetInfo*)MCInfo); + llvm::archViewer(*(const llvm::MCSubtargetInfo*)MCInfo); #else MCInfo->getAllProcessorDescriptions(); #endif @@ -830,7 +837,7 @@ const Array LLVMTargetInfo::GetAllLLVMCpuFeatures() const { // get all features for CPU llvm::ArrayRef llvm_features = #if TVM_LLVM_VERSION < 180 - llvm::featViewer(*(llvm::MCSubtargetInfo*)MCInfo); + llvm::featViewer(*(const llvm::MCSubtargetInfo*)MCInfo); #else MCInfo->getAllProcessorFeatures(); #endif